use of org.apache.calcite.rel.logical.LogicalMatch in project coral by linkedin.
the class IRRelToSparkRelTransformer method transform.
/**
* This API is used to transforms IR RelNode to make it compatible with spark.
*
* @return [[SparkRelInfo]] containing the Spark RelNode and list of standard UDFs.
*/
static SparkRelInfo transform(RelNode calciteNode) {
Set<SparkUDFInfo> sparkUDFInfos = new HashSet<>();
RelShuttle converter = new RelShuttleImpl() {
@Override
public RelNode visit(LogicalProject project) {
return super.visit(project).accept(getSparkRexConverter(project));
}
@Override
public RelNode visit(LogicalFilter inputFilter) {
return super.visit(inputFilter).accept(getSparkRexConverter(inputFilter));
}
@Override
public RelNode visit(LogicalAggregate aggregate) {
return super.visit(aggregate).accept(getSparkRexConverter(aggregate));
}
@Override
public RelNode visit(LogicalMatch match) {
return super.visit(match).accept(getSparkRexConverter(match));
}
@Override
public RelNode visit(TableScan scan) {
return super.visit(scan).accept(getSparkRexConverter(scan));
}
@Override
public RelNode visit(TableFunctionScan scan) {
return super.visit(scan).accept(getSparkRexConverter(scan));
}
@Override
public RelNode visit(LogicalValues values) {
return super.visit(values).accept(getSparkRexConverter(values));
}
@Override
public RelNode visit(LogicalJoin join) {
return super.visit(join).accept(getSparkRexConverter(join));
}
@Override
public RelNode visit(LogicalCorrelate correlate) {
return super.visit(correlate).accept(getSparkRexConverter(correlate));
}
@Override
public RelNode visit(LogicalUnion union) {
return super.visit(union).accept(getSparkRexConverter(union));
}
@Override
public RelNode visit(LogicalIntersect intersect) {
return super.visit(intersect).accept(getSparkRexConverter(intersect));
}
@Override
public RelNode visit(LogicalMinus minus) {
return super.visit(minus).accept(getSparkRexConverter(minus));
}
@Override
public RelNode visit(LogicalSort sort) {
return super.visit(sort).accept(getSparkRexConverter(sort));
}
@Override
public RelNode visit(LogicalExchange exchange) {
return super.visit(exchange).accept(getSparkRexConverter(exchange));
}
@Override
public RelNode visit(RelNode other) {
return super.visit(other).accept(getSparkRexConverter(other));
}
private SparkRexConverter getSparkRexConverter(RelNode node) {
return new SparkRexConverter(node.getCluster().getRexBuilder(), sparkUDFInfos);
}
};
return new SparkRelInfo(calciteNode.accept(converter), new ArrayList<>(sparkUDFInfos));
}
use of org.apache.calcite.rel.logical.LogicalMatch in project calcite by apache.
the class MatchRule method onMatch.
// ~ Methods ----------------------------------------------------------------
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalMatch oldRel = call.rel(0);
final RelNode match = LogicalMatch.create(oldRel.getCluster(), oldRel.getTraitSet(), oldRel.getInput(), oldRel.getRowType(), oldRel.getPattern(), oldRel.isStrictStart(), oldRel.isStrictEnd(), oldRel.getPatternDefinitions(), oldRel.getMeasures(), oldRel.getAfter(), oldRel.getSubsets(), oldRel.isAllRows(), oldRel.getPartitionKeys(), oldRel.getOrderKeys(), oldRel.getInterval());
call.transformTo(match);
}
Aggregations