topChildExprs = ImmutableList.copyOf(RexUtil.apply(mapping, topChildExprs));
final RexCallBinding binding = RexCallBinding.create(cluster.getTypeFactory(), cast, ImmutableList.of(RexUtil.apply(map, sort.getCollation()))); if (cast.getOperator().getMonotonicity(binding) == SqlMonotonicity.NOT_MONOTONIC) { return;
topChildExprs = ImmutableList.copyOf(RexUtil.apply(mapping, topChildExprs));
topChildExprs = ImmutableList.copyOf(RexUtil.apply(mapping, topChildExprs));
topChildExprs = ImmutableList.copyOf(RexUtil.apply(mapping, topChildExprs));
RelCollation newCollation = RexUtil.apply(mapping, oldCollation);
RelCollation newCollation = RexUtil.apply(mapping, oldCollation);
RexUtil.apply(visitor, correlatedJoinKeys, null); List<RexFieldAccess> correlatedKeyList = visitor.getFieldAccessList();
belowOffset); final RexNode newCondition = RexUtil.apply(mapping, join.getCondition());
RelCollation newCollation = RexUtil.apply(mapping, oldCollation);
RelCollation newCollation = RexUtil.apply(mapping, oldCollation);
RexUtil.apply(visitor, correlatedJoinKeys, null); List<RexFieldAccess> correlatedKeyList = visitor.getFieldAccessList();
belowOffset); final RexNode newCondition = RexUtil.apply(mapping, join.getCondition());
public void onMatch(RelOptRuleCall call) { final HiveSortLimit sort = call.rel(0); final HiveProject project = call.rel(1); // Determine mapping between project input and output fields. If sort // relies on non-trivial expressions, we can't push. final Mappings.TargetMapping map = RelOptUtil.permutation( project.getProjects(), project.getInput().getRowType()); for (RelFieldCollation fc : sort.getCollation().getFieldCollations()) { if (map.getTargetOpt(fc.getFieldIndex()) < 0) { return; } } // Create new collation final RelCollation newCollation = RelCollationTraitDef.INSTANCE.canonize( RexUtil.apply(map, sort.getCollation())); // New operators final HiveSortLimit newSort = sort.copy(sort.getTraitSet().replace(newCollation), project.getInput(), newCollation, sort.offset, sort.fetch); final RelNode newProject = project.copy(sort.getTraitSet(), ImmutableList.<RelNode>of(newSort)); call.transformTo(newProject); }
public void onMatch(RelOptRuleCall call) { final HiveProject project = call.rel(0); final HiveSortLimit sort = call.rel(1); // Determine mapping between project input and output fields. If sort // relies on non-trivial expressions, we can't push. final Mappings.TargetMapping map = RelOptUtil.permutation( project.getProjects(), project.getInput().getRowType()).inverse(); for (RelFieldCollation fc : sort.getCollation().getFieldCollations()) { if (map.getTarget(fc.getFieldIndex()) < 0) { return; } } // Create new collation final RelCollation newCollation = RelCollationTraitDef.INSTANCE.canonize( RexUtil.apply(map, sort.getCollation())); // New operators final RelNode newProject = project.copy(sort.getInput().getTraitSet(), ImmutableList.<RelNode>of(sort.getInput())); final HiveSortLimit newSort = sort.copy(newProject.getTraitSet(), newProject, newCollation, sort.offset, sort.fetch); call.transformTo(newSort); }
/** * Returns whether an expression list contains an OVER clause. */ public static boolean containsOver(List<RexNode> exprs, RexNode condition) { try { RexUtil.apply(FINDER, exprs, condition); return false; } catch (OverFound e) { Util.swallow(e, null); return true; } }
/** * Returns whether a program contains an OVER clause. */ public static boolean containsOver(RexProgram program) { try { RexUtil.apply(FINDER, program.getExprList(), null); return false; } catch (OverFound e) { Util.swallow(e, null); return true; } }
/** * Returns a bit set describing the inputs used by a collection of * project expressions and an optional condition. */ public static ImmutableBitSet bits(List<RexNode> exprs, RexNode expr) { final InputFinder inputFinder = new InputFinder(); RexUtil.apply(inputFinder, exprs, expr); return inputFinder.inputBitSet.build(); }
/** * Returns whether a program contains an OVER clause. */ public static boolean containsOver(RexProgram program) { try { RexUtil.apply(FINDER, program.getExprList(), null); return false; } catch (OverFound e) { Util.swallow(e, null); return true; } }
/** * Returns a bit set describing the inputs used by a collection of * project expressions and an optional condition. */ public static ImmutableBitSet bits(List<RexNode> exprs, RexNode expr) { final InputFinder inputFinder = new InputFinder(); RexUtil.apply(inputFinder, exprs, expr); return inputFinder.inputBitSet.build(); }