org.apache.calcite.plan.Convention Java Examples
The following examples show how to use
org.apache.calcite.plan.Convention.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VolcanoPlanner.java From Bats with Apache License 2.0 | 6 votes |
/** * Finds RelSubsets in the plan that contain only rels of * {@link Convention#NONE} and boosts their importance by 25%. */ private void injectImportanceBoost() { final Set<RelSubset> requireBoost = new HashSet<>(); SUBSET_LOOP: for (RelSubset subset : ruleQueue.subsetImportances.keySet()) { for (RelNode rel : subset.getRels()) { if (rel.getConvention() != Convention.NONE) { continue SUBSET_LOOP; } } requireBoost.add(subset); } ruleQueue.boostImportance(requireBoost, 1.25); }
Example #2
Source File: LogicalMatch.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a LogicalMatch. */ public static LogicalMatch create(RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, Map<String, RexNode> patternDefinitions, Map<String, RexNode> measures, RexNode after, Map<String, ? extends SortedSet<String>> subsets, boolean allRows, List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval) { final RelOptCluster cluster = input.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalMatch(cluster, traitSet, input, rowType, pattern, strictStart, strictEnd, patternDefinitions, measures, after, subsets, allRows, partitionKeys, orderKeys, interval); }
Example #3
Source File: SemiJoin.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a SemiJoin. */ public static SemiJoin create(RelNode left, RelNode right, RexNode condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys) { final RelOptCluster cluster = left.getCluster(); return new SemiJoin(cluster, cluster.traitSetOf(Convention.NONE), left, right, condition, leftKeys, rightKeys); }
Example #4
Source File: LogicalProject.java From Bats with Apache License 2.0 | 5 votes |
/** 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, () -> RelMdCollation.project(mq, input, projects)); return new LogicalProject(cluster, traitSet, input, projects, rowType); }
Example #5
Source File: LogicalAggregate.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalAggregate( RelOptCluster cluster, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) { this(cluster, cluster.traitSetOf(Convention.NONE), child, indicator, groupSet, groupSets, aggCalls); }
Example #6
Source File: LogicalAggregate.java From Bats with Apache License 2.0 | 5 votes |
private static LogicalAggregate create_(final RelNode input, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) { final RelOptCluster cluster = input.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalAggregate(cluster, traitSet, input, indicator, groupSet, groupSets, aggCalls); }
Example #7
Source File: LogicalTableScan.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalTableScan. * * @param cluster Cluster * @param relOptTable Table */ public static LogicalTableScan create(RelOptCluster cluster, final RelOptTable relOptTable) { final Table table = relOptTable.unwrap(Table.class); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> { if (table != null) { return table.getStatistic().getCollations(); } return ImmutableList.of(); }); return new LogicalTableScan(cluster, traitSet, relOptTable); }
Example #8
Source File: LogicalTableModify.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalTableModify. */ public static LogicalTableModify create(RelOptTable table, CatalogReader schema, RelNode input, Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) { final RelOptCluster cluster = input.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalTableModify(cluster, traitSet, table, schema, input, operation, updateColumnList, sourceExpressionList, flattened); }
Example #9
Source File: LogicalExchange.java From Bats with Apache License 2.0 | 5 votes |
/** * 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); }
Example #10
Source File: DrillFilterRelBase.java From Bats with Apache License 2.0 | 5 votes |
protected DrillFilterRelBase(Convention convention, RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) { super(cluster, traits, child, condition); assert getConvention() == convention; // save the number of conjuncts that make up the filter condition such // that repeated calls to the costing function can use the saved copy conjunctions = RelOptUtil.conjunctions(condition); numConjuncts = conjunctions.size(); // assert numConjuncts >= 1; filterMinSelectivityEstimateFactor = PrelUtil. getPlannerSettings(cluster.getPlanner()).getFilterMinSelectivityEstimateFactor(); filterMaxSelectivityEstimateFactor = PrelUtil. getPlannerSettings(cluster.getPlanner()).getFilterMaxSelectivityEstimateFactor(); }
Example #11
Source File: LogicalTableModify.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalTableModify(RelOptCluster cluster, RelOptTable table, CatalogReader schema, RelNode input, Operation operation, List<String> updateColumnList, boolean flattened) { this(cluster, cluster.traitSetOf(Convention.NONE), table, schema, input, operation, updateColumnList, null, flattened); }
Example #12
Source File: LogicalTableFunctionScan.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalTableFunctionScan( RelOptCluster cluster, List<RelNode> inputs, RexNode rexCall, Type elementType, RelDataType rowType, Set<RelColumnMapping> columnMappings) { this(cluster, cluster.traitSetOf(Convention.NONE), inputs, rexCall, elementType, rowType, columnMappings); }
Example #13
Source File: LogicalTableFunctionScan.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalTableFunctionScan. */ public static LogicalTableFunctionScan create( RelOptCluster cluster, List<RelNode> inputs, RexNode rexCall, Type elementType, RelDataType rowType, Set<RelColumnMapping> columnMappings) { final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalTableFunctionScan(cluster, traitSet, inputs, rexCall, elementType, rowType, columnMappings); }
Example #14
Source File: LogicalCorrelate.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalCorrelate. */ public static LogicalCorrelate create(RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType joinType) { final RelOptCluster cluster = left.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalCorrelate(cluster, traitSet, left, right, correlationId, requiredColumns, joinType); }
Example #15
Source File: LogicalMatch.java From Bats with Apache License 2.0 | 5 votes |
@Override public Match copy(RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, Map<String, RexNode> patternDefinitions, Map<String, RexNode> measures, RexNode after, Map<String, ? extends SortedSet<String>> subsets, boolean allRows, List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval) { final RelTraitSet traitSet = getCluster().traitSetOf(Convention.NONE); return new LogicalMatch(getCluster(), traitSet, input, rowType, pattern, strictStart, strictEnd, patternDefinitions, measures, after, subsets, allRows, partitionKeys, orderKeys, interval); }
Example #16
Source File: DrillAggregateRule.java From Bats with Apache License 2.0 | 5 votes |
private DrillAggregateRule() { super( RelOptHelper.some(LogicalAggregate.class, Convention.NONE, RelOptHelper.any(RelNode.class)), DrillRelFactories.LOGICAL_BUILDER, "DrillAggregateRule"); }
Example #17
Source File: LogicalSortExchange.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a LogicalSortExchange. * * @param input Input relational expression * @param distribution Distribution specification * @param collation array of sort specifications */ public static LogicalSortExchange create( RelNode input, RelDistribution distribution, RelCollation collation) { RelOptCluster cluster = input.getCluster(); collation = RelCollationTraitDef.INSTANCE.canonize(collation); distribution = RelDistributionTraitDef.INSTANCE.canonize(distribution); RelTraitSet traitSet = input.getTraitSet().replace(Convention.NONE).replace(distribution).replace(collation); return new LogicalSortExchange(cluster, traitSet, input, distribution, collation); }
Example #18
Source File: LogicalCalc.java From Bats with Apache License 2.0 | 5 votes |
public static LogicalCalc create(final RelNode input, final RexProgram program) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSet() .replace(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.calc(mq, input, program)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> RelMdDistribution.calc(mq, input, program)); return new LogicalCalc(cluster, traitSet, input, program); }
Example #19
Source File: LogicalFilter.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalFilter( RelOptCluster cluster, RelNode child, RexNode condition) { this(cluster, cluster.traitSetOf(Convention.NONE), child, condition, ImmutableSet.of()); }
Example #20
Source File: LogicalFilter.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalFilter. */ public static LogicalFilter create(final RelNode input, RexNode condition, ImmutableSet<CorrelationId> variablesSet) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.filter(mq, input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> RelMdDistribution.filter(mq, input)); return new LogicalFilter(cluster, traitSet, input, condition, variablesSet); }
Example #21
Source File: LogicalJoin.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalJoin(RelOptCluster cluster, RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped) { this(cluster, cluster.traitSetOf(Convention.NONE), left, right, condition, CorrelationId.setOf(variablesStopped), joinType, false, ImmutableList.of()); }
Example #22
Source File: LogicalJoin.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalJoin(RelOptCluster cluster, RelNode left, RelNode right, RexNode condition, JoinRelType joinType, Set<String> variablesStopped, boolean semiJoinDone, ImmutableList<RelDataTypeField> systemFieldList) { this(cluster, cluster.traitSetOf(Convention.NONE), left, right, condition, CorrelationId.setOf(variablesStopped), joinType, semiJoinDone, systemFieldList); }
Example #23
Source File: LogicalJoin.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a LogicalJoin by parsing serialized output. */ public LogicalJoin(RelInput input) { this(input.getCluster(), input.getCluster().traitSetOf(Convention.NONE), input.getInputs().get(0), input.getInputs().get(1), input.getExpression("condition"), ImmutableSet.of(), input.getEnum("joinType", JoinRelType.class), false, ImmutableList.of()); }
Example #24
Source File: LogicalJoin.java From Bats with Apache License 2.0 | 5 votes |
/** 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); }
Example #25
Source File: LogicalSnapshot.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalSnapshot. */ public static LogicalSnapshot create(RelNode input, RexNode period) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSet() .replace(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.snapshot(mq, input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> RelMdDistribution.snapshot(mq, input)); return new LogicalSnapshot(cluster, traitSet, input, period); }
Example #26
Source File: LogicalValues.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalValues( RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples) { this(cluster, cluster.traitSetOf(Convention.NONE), rowType, tuples); }
Example #27
Source File: LogicalValues.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a LogicalValues. */ public static LogicalValues create(RelOptCluster cluster, final RelDataType rowType, final ImmutableList<ImmutableList<RexLiteral>> tuples) { final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.values(mq, rowType, tuples)); return new LogicalValues(cluster, traitSet, rowType, tuples); }
Example #28
Source File: LogicalCorrelate.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public LogicalCorrelate(RelOptCluster cluster, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType joinType) { this(cluster, cluster.traitSetOf(Convention.NONE), left, right, correlationId, requiredColumns, joinType); }
Example #29
Source File: DrillValuesRule.java From Bats with Apache License 2.0 | 4 votes |
private DrillValuesRule() { super(RelOptHelper.any(LogicalValues.class, Convention.NONE), DrillRelFactories.LOGICAL_BUILDER, "DrillValuesRule"); }
Example #30
Source File: OLAPJoinRule.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
public OLAPJoinRule() { super(LogicalJoin.class, Convention.NONE, OLAPRel.CONVENTION, "OLAPJoinRule"); }