/** * Remove correlated variables from the tree at root corRel. * * @param correlate Correlator */ private void removeCorVarFromTree(LogicalCorrelate correlate) { if (cm.mapCorToCorRel.get(correlate.getCorrelationId()) == correlate) { cm.mapCorToCorRel.remove(correlate.getCorrelationId()); } }
@Override public RelNode convert(RelNode rel) { LogicalValues values = (LogicalValues) rel; return OLAPValuesRel.create(values.getCluster(), values.getRowType(), values.getTuples()); } }
@Override public RelNode toRel(final RelOptTable.ToRelContext context, final RelOptTable table) { return LogicalTableScan.create(context.getCluster(), table); }
@Override public RelNode convert(RelNode rel) { LogicalFilter filter = (LogicalFilter) rel; RelTraitSet origTraitSet = filter.getTraitSet(); RelTraitSet traitSet = origTraitSet.replace(OLAPRel.CONVENTION).simplify(); return new OLAPFilterRel(filter.getCluster(), traitSet, convert(filter.getInput(), filter.getInput().getTraitSet().replace(OLAPRel.CONVENTION)), filter.getCondition()); } }
public RelNode visit(LogicalProject project) { return visitChild(project, 0, project.getInput()); }
public RelNode visit(LogicalFilter filter) { return visitChild(filter, 0, filter.getInput()); }
public RelNode visit(LogicalAggregate aggregate) { return visitChild(aggregate, 0, aggregate.getInput()); }
public List<RelCollation> get() { // CALCITE-88 return RelMdCollation.project(cluster.getMetadataQuery(), convertChild, project.getProjects()); } });
private boolean containsAvg(LogicalAggregate agg) { for (AggregateCall call : agg.getAggCallList()) { SqlAggFunction func = call.getAggregation(); if (func instanceof SqlAvgAggFunction) return true; } return false; }
@Override public RelNode visit(LogicalJoin join) { try { Stacks.push(stack, join); join.getCondition().accept(rexVisitor(join)); } finally { Stacks.pop(stack, join); } return visitJoin(join); }
@Override public RelNode toRel(ToRelContext context) { return new LogicalTableScan(context.getCluster(), this); }
@Override public void onMatch(final RelOptRuleCall call) { final LogicalTableScan scan = call.rel(0); final RelOptTable table = scan.getTable(); final DruidTable druidTable = table.unwrap(DruidTable.class); if (druidTable != null) { call.transformTo( DruidQueryRel.fullScan(scan, table, druidTable, queryMaker) ); } } }
/** * Create a DruidQueryRel representing a full scan. */ public static DruidQueryRel fullScan( final LogicalTableScan scanRel, final RelOptTable table, final DruidTable druidTable, final QueryMaker queryMaker ) { return new DruidQueryRel( scanRel.getCluster(), scanRel.getCluster().traitSetOf(Convention.NONE), table, druidTable, queryMaker, PartialDruidQuery.create(scanRel) ); }
public RelNode visit(LogicalProject project) { return visitChild(project, 0, project.getInput()); }
public RelNode visit(LogicalFilter filter) { return visitChild(filter, 0, filter.getInput()); }
public RelNode visit(LogicalAggregate aggregate) { return visitChild(aggregate, 0, aggregate.getInput()); }
/** * Remove correlated variables from the tree at root corRel * * @param correlate Correlator */ private void removeCorVarFromTree(LogicalCorrelate correlate) { if (cm.mapCorToCorRel.get(correlate.getCorrelationId()) == correlate) { cm.mapCorToCorRel.remove(correlate.getCorrelationId()); } }
@Override public RelNode toRel(ToRelContext context) { return new LogicalTableScan(context.getCluster(), this); }
@Override public RelNode visit(LogicalCorrelate correlate) { mapCorToCorRel.put(correlate.getCorrelationId(), correlate); return visitJoin(correlate); }
@Override public RelNode visit(LogicalCorrelate correlate) { mapCorToCorRel.put(correlate.getCorrelationId(), correlate); return visitJoin(correlate); }