use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster in project calcite by apache.
the class RelMdPredicates method getPredicates.
/**
* Infers predicates for a {@link org.apache.calcite.rel.core.Join} (including
* {@link org.apache.calcite.rel.core.SemiJoin}).
*/
public RelOptPredicateList getPredicates(Join join, RelMetadataQuery mq) {
RelOptCluster cluster = join.getCluster();
RexBuilder rexBuilder = cluster.getRexBuilder();
final RexExecutor executor = Util.first(cluster.getPlanner().getExecutor(), RexUtil.EXECUTOR);
final RelNode left = join.getInput(0);
final RelNode right = join.getInput(1);
final RelOptPredicateList leftInfo = mq.getPulledUpPredicates(left);
final RelOptPredicateList rightInfo = mq.getPulledUpPredicates(right);
final RexSimplify simplifier = new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, true, executor);
JoinConditionBasedPredicateInference joinInference = new JoinConditionBasedPredicateInference(join, RexUtil.composeConjunction(rexBuilder, leftInfo.pulledUpPredicates, false), RexUtil.composeConjunction(rexBuilder, rightInfo.pulledUpPredicates, false), simplifier);
return joinInference.inferPredicates(false);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster in project calcite by apache.
the class LogicalExchange method create.
/**
* Creates a LogicalExchange.
*
* @param input Input relational expression
* @param distribution Distribution specification
*/
public static LogicalExchange create(RelNode input, RelDistribution distribution) {
RelOptCluster cluster = input.getCluster();
distribution = RelDistributionTraitDef.INSTANCE.canonize(distribution);
RelTraitSet traitSet = input.getTraitSet().replace(Convention.NONE).replace(distribution);
return new LogicalExchange(cluster, traitSet, input, distribution);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster in project calcite by apache.
the class LogicalJoin method create.
/**
* Creates a LogicalJoin, flagged with whether it has been translated to a
* semi-join.
*/
public static LogicalJoin create(RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType, boolean semiJoinDone, ImmutableList<RelDataTypeField> systemFieldList) {
final RelOptCluster cluster = left.getCluster();
final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE);
return new LogicalJoin(cluster, traitSet, left, right, condition, variablesSet, joinType, semiJoinDone, systemFieldList);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster in project calcite by apache.
the class LogicalProject method create.
// ~ Methods ----------------------------------------------------------------
/**
* Creates a LogicalProject.
*/
public static LogicalProject create(final RelNode input, final List<? extends RexNode> projects, List<String> fieldNames) {
final RelOptCluster cluster = input.getCluster();
final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, SqlValidatorUtil.F_SUGGESTER);
return create(input, projects, rowType);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster in project calcite by apache.
the class LogicalProject method create.
/**
* Creates a LogicalProject, specifying row type rather than field names.
*/
public static LogicalProject create(final RelNode input, final List<? extends RexNode> projects, RelDataType rowType) {
final RelOptCluster cluster = input.getCluster();
final RelMetadataQuery mq = cluster.getMetadataQuery();
final RelTraitSet traitSet = cluster.traitSet().replace(Convention.NONE).replaceIfs(RelCollationTraitDef.INSTANCE, new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
return RelMdCollation.project(mq, input, projects);
}
});
return new LogicalProject(cluster, traitSet, input, projects, rowType);
}
Aggregations