/** * Finds RelSubsets in the plan that contain only rels of {@link * Convention#NONE} and boosts their importance by 25%. */ private void injectImportanceBoost() { HashSet<RelSubset> requireBoost = new HashSet<RelSubset>(); 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); }
/** * Finds RelSubsets in the plan that contain only rels of {@link * Convention#NONE} and boosts their importance by 25%. */ private void injectImportanceBoost() { HashSet<RelSubset> requireBoost = new HashSet<RelSubset>(); 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); }
public EnumerableSortRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation, RexNode offset, RexNode fetch) { super(cluster, traitSet, child, collation, offset, fetch); assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public EnumerableLimitRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RexNode offset, RexNode fetch) { super(cluster, traitSet, child); this.offset = offset; this.fetch = fetch; assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public EnumerableUncollectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child) { super(cluster, traitSet, child); assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public JdbcSortRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation) { super(cluster, traitSet, child, collation); assert getConvention() instanceof JdbcConvention; assert getConvention() == child.getConvention(); }
public EnumerableLimitRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RexNode offset, RexNode fetch) { super(cluster, traitSet, child); this.offset = offset; this.fetch = fetch; assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public JdbcSortRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation) { super(cluster, traitSet, child, collation); assert getConvention() instanceof JdbcConvention; assert getConvention() == child.getConvention(); }
public EnumerableSortRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation, RexNode offset, RexNode fetch) { super(cluster, traitSet, child, collation, offset, fetch); assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public EnumerableCollectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, String fieldName) { super(cluster, traitSet, child, fieldName); assert getConvention() instanceof EnumerableConvention; assert getConvention() == child.getConvention(); }
public EnumerableTableModificationRel( RelOptCluster cluster, RelTraitSet traits, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super( cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); assert child.getConvention() instanceof EnumerableConvention; assert getConvention() instanceof EnumerableConvention; final ModifiableTable modifiableTable = table.unwrap(ModifiableTable.class); if (modifiableTable == null) { throw new AssertionError(); // TODO: user error in validator } }
public JdbcTableModificationRel( RelOptCluster cluster, RelTraitSet traits, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super( cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); assert child.getConvention() instanceof JdbcConvention; assert getConvention() instanceof JdbcConvention; final ModifiableTable modifiableTable = table.unwrap(ModifiableTable.class); if (modifiableTable == null) { throw new AssertionError(); // TODO: user error in validator } this.expression = table.getExpression(Queryable.class); if (expression == null) { throw new AssertionError(); // TODO: user error in validator } }
public JdbcTableModificationRel( RelOptCluster cluster, RelTraitSet traits, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super( cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); assert child.getConvention() instanceof JdbcConvention; assert getConvention() instanceof JdbcConvention; final ModifiableTable modifiableTable = table.unwrap(ModifiableTable.class); if (modifiableTable == null) { throw new AssertionError(); // TODO: user error in validator } this.expression = modifiableTable.getExpression(); if (expression == null) { throw new AssertionError(); // TODO: user error in validator } }
public EnumerableTableModificationRel( RelOptCluster cluster, RelTraitSet traits, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super( cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); assert child.getConvention() instanceof EnumerableConvention; assert getConvention() instanceof EnumerableConvention; final ModifiableTable modifiableTable = table.unwrap(ModifiableTable.class); if (modifiableTable == null) { throw new AssertionError(); // TODO: user error in validator } this.expression = modifiableTable.getExpression(); if (expression == null) { throw new AssertionError(); // TODO: user error in validator } }
/** * Tries to convert a relational expression to the target convention of an * arc. */ private RelNode changeConvention( RelNode rel, Convention source, Convention target, final Multimap<Pair<Convention, Convention>, ConverterRule> mapArcToConverterRule) { assert source == rel.getConvention(); // Try to apply each converter rule for this arc's source/target calling // conventions. final Pair<Convention, Convention> key = Pair.of(source, target); for (ConverterRule rule : mapArcToConverterRule.get(key)) { assert rule.getInTrait() == source; assert rule.getOutTrait() == target; RelNode converted = rule.convert(rel); if (converted != null) { return converted; } } return null; }
final ConversionData conversionData = getConversionData(planner); final Convention fromConvention = rel.getConvention();
@Override public RelNode convert(RelNode rel) { final SemiJoinRel semiJoin = (SemiJoinRel) rel; List<RelNode> newInputs = new ArrayList<RelNode>(); for (RelNode input : semiJoin.getInputs()) { if (!(input.getConvention() instanceof EnumerableConvention)) { input = convert(input, input.getTraitSet().replace(EnumerableConvention.INSTANCE)); } newInputs.add(input); } try { return new EnumerableSemiJoinRel( semiJoin.getCluster(), semiJoin.getTraitSet().replace(EnumerableConvention.INSTANCE), newInputs.get(0), newInputs.get(1), semiJoin.getCondition(), semiJoin.leftKeys, semiJoin.rightKeys); } catch (InvalidRelException e) { LOGGER.fine(e.toString()); return null; } } }
/** * Tries to convert a relational expression to the target convention of an * arc. */ private RelNode changeConvention( RelNode rel, Graph.Arc arc, final MultiMap<Graph.Arc, ConverterRule> mapArcToConverterRule) { assert (arc.from == rel.getConvention()); // Try to apply each converter rule for this arc's source/target calling // conventions. for (ConverterRule rule : mapArcToConverterRule.getMulti(arc)) { assert rule.getInTrait() == arc.from; assert rule.getOutTrait() == arc.to; RelNode converted = rule.convert(rel); if (converted != null) { return converted; } } return null; }
@Override public RelNode convert(RelNode rel) { JoinRel join = (JoinRel) rel; List<RelNode> newInputs = new ArrayList<RelNode>(); for (RelNode input : join.getInputs()) { if (!(input.getConvention() instanceof EnumerableConvention)) { input = convert( input, input.getTraitSet() .replace(EnumerableConvention.INSTANCE)); } newInputs.add(input); } try { return new EnumerableJoinRel( join.getCluster(), join.getTraitSet().replace(EnumerableConvention.INSTANCE), newInputs.get(0), newInputs.get(1), join.getCondition(), join.getJoinType(), join.getVariablesStopped()); } catch (InvalidRelException e) { tracer.warning(e.toString()); return null; } } }
@Override public RelNode convert(RelNode rel) { JoinRel join = (JoinRel) rel; List<RelNode> newInputs = new ArrayList<RelNode>(); for (RelNode input : join.getInputs()) { if (!(input.getConvention() == getOutTrait())) { input = convert( input, input.getTraitSet().replace(out)); } newInputs.add(input); } try { return new JdbcJoinRel( join.getCluster(), join.getTraitSet().replace(out), newInputs.get(0), newInputs.get(1), join.getCondition(), join.getJoinType(), join.getVariablesStopped()); } catch (InvalidRelException e) { tracer.warning(e.toString()); return null; } } }