Java源码示例:org.apache.calcite.rel.core.Sample

示例1
public final T traverse(RelNode n) throws Exception {
  List<T> inputStreams = new ArrayList<>();
  for (RelNode input : n.getInputs()) {
    inputStreams.add(traverse(input));
  }

  if (n instanceof Aggregate) {
    return visitAggregate((Aggregate) n, inputStreams);
  } else if (n instanceof Calc) {
    return visitCalc((Calc) n, inputStreams);
  } else if (n instanceof Collect) {
    return visitCollect((Collect) n, inputStreams);
  } else if (n instanceof Correlate) {
    return visitCorrelate((Correlate) n, inputStreams);
  } else if (n instanceof Delta) {
    return visitDelta((Delta) n, inputStreams);
  } else if (n instanceof Exchange) {
    return visitExchange((Exchange) n, inputStreams);
  } else if (n instanceof Project) {
    return visitProject((Project) n, inputStreams);
  } else if (n instanceof Filter) {
    return visitFilter((Filter) n, inputStreams);
  } else if (n instanceof Sample) {
    return visitSample((Sample) n, inputStreams);
  } else if (n instanceof Sort) {
    return visitSort((Sort) n, inputStreams);
  } else if (n instanceof TableModify) {
    return visitTableModify((TableModify) n, inputStreams);
  } else if (n instanceof TableScan) {
    return visitTableScan((TableScan) n, inputStreams);
  } else if (n instanceof Uncollect) {
    return visitUncollect((Uncollect) n, inputStreams);
  } else if (n instanceof Window) {
    return visitWindow((Window) n, inputStreams);
  } else if (n instanceof Join) {
    return visitJoin((Join) n, inputStreams);
  } else {
    return defaultValue(n, inputStreams);
  }
}
 
示例2
@Test void testNodeTypeCountSample() {
  final String sql = "select * from emp tablesample system(50) where empno > 5";
  final Map<Class<? extends RelNode>, Integer> expected = new HashMap<>();
  expected.put(TableScan.class, 1);
  expected.put(Filter.class, 1);
  expected.put(Project.class, 1);
  expected.put(Sample.class, 1);
  checkNodeTypeCount(sql, expected);
}
 
示例3
public void rewriteRel(Sample rel) {
    rewriteGeneric(rel);
}
 
示例4
public T visitSample(Sample sample, List<T> inputStreams) throws Exception {
  return defaultValue(sample, inputStreams);
}
 
示例5
/**
 * Table references from Sample.
 */
public Set<RelTableRef> getTableReferences(Sample rel, RelMetadataQuery mq) {
  return mq.getTableReferences(rel.getInput());
}
 
示例6
public Multimap<Class<? extends RelNode>, RelNode> getNodeTypes(Sample rel,
    RelMetadataQuery mq) {
  return getNodeTypes(rel, Sample.class, mq);
}
 
示例7
public void rewriteRel(Sample rel) {
  rewriteGeneric(rel);
}