case SORT: final MutableSort sort = (MutableSort) node; return LogicalSort.create(fromMutable(sort.input), sort.collation, sort.offset, sort.fetch); case UNION:
public RelNode createSort(RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { return LogicalSort.create(input, collation, offset, fetch); }
public RelNode createSort(RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { return LogicalSort.create(input, collation, offset, fetch); }
private static RelNode createEmptyEmptyRelHelper(SingleRel input) { return LogicalSort.create(input.getInput(), RelCollations.EMPTY, input.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0)), input.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0))); } }
@Override public void onMatch(RelOptRuleCall call) { final Delta delta = call.rel(0); Util.discard(delta); final Sort sort = call.rel(1); final LogicalDelta newDelta = LogicalDelta.create(sort.getInput()); final LogicalSort newSort = LogicalSort.create(newDelta, sort.collation, sort.offset, sort.fetch); call.transformTo(newSort); } }
@Override public void onMatch(RelOptRuleCall call) { final Delta delta = call.rel(0); Util.discard(delta); final Sort sort = call.rel(1); final LogicalDelta newDelta = LogicalDelta.create(sort.getInput()); final LogicalSort newSort = LogicalSort.create(newDelta, sort.collation, sort.offset, sort.fetch); call.transformTo(newSort); } }
public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation.getFieldCollations().isEmpty()) { // An empty sort doesn't make sense. return null; } // Create a logical sort, then ask the planner to convert its remaining // traits (e.g. convert it to an EnumerableSortRel if rel is enumerable // convention) final Sort sort = LogicalSort.create(rel, toCollation, null, null); RelNode newRel = planner.register(sort, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }
LogicalSort.create(bb.root, collation, offset == null ? null : convertExpression(offset), fetch == null ? null : convertExpression(fetch)),
public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation.getFieldCollations().isEmpty()) { // An empty sort doesn't make sense. return null; } // Create a logical sort, then ask the planner to convert its remaining // traits (e.g. convert it to an EnumerableSortRel if rel is enumerable // convention) final Sort sort = LogicalSort.create(rel, toCollation, null, null); RelNode newRel = planner.register(sort, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }
LogicalSort.create(bb.root, collation, offset == null ? null : convertExpression(offset), fetch == null ? null : convertExpression(fetch)),
LogicalSort.create(bb.root, collation, offset == null ? null : convertExpression(offset), fetch == null ? null : convertExpression(fetch)),
LogicalSort.create(bb.root, collation, offset == null ? null : convertExpression(offset), fetch == null ? null : convertExpression(fetch)),
LogicalSort.create(newInput, newCollation, rel.offset, rel.fetch);
public void rewriteRel(Sort rel) { RelCollation oldCollation = rel.getCollation(); final RelNode oldChild = rel.getInput(); final RelNode newChild = getNewForOldRel(oldChild); final Mappings.TargetMapping mapping = getNewForOldInputMapping(oldChild); // validate for (RelFieldCollation field : oldCollation.getFieldCollations()) { int oldInput = field.getFieldIndex(); RelDataType sortFieldType = oldChild.getRowType().getFieldList().get(oldInput).getType(); if (sortFieldType.isStruct()) { // TODO jvs 10-Feb-2005 throw Util.needToImplement("sorting on structured types"); } } RelCollation newCollation = RexUtil.apply(mapping, oldCollation); Sort newRel = LogicalSort.create(newChild, newCollation, rel.offset, rel.fetch); setNewForOldRel(rel, newRel); }
public void rewriteRel(Sort rel) { RelCollation oldCollation = rel.getCollation(); final RelNode oldChild = rel.getInput(); final RelNode newChild = getNewForOldRel(oldChild); final Mappings.TargetMapping mapping = getNewForOldInputMapping(oldChild); // validate for (RelFieldCollation field : oldCollation.getFieldCollations()) { int oldInput = field.getFieldIndex(); RelDataType sortFieldType = oldChild.getRowType().getFieldList().get(oldInput).getType(); if (sortFieldType.isStruct()) { // TODO jvs 10-Feb-2005 throw Util.needToImplement("sorting on structured types"); } } RelCollation newCollation = RexUtil.apply(mapping, oldCollation); Sort newRel = LogicalSort.create(newChild, newCollation, rel.offset, rel.fetch); setNewForOldRel(rel, newRel); }
LogicalSort.create(newInput, newCollation, rel.offset, rel.fetch);
LogicalSort.create(newInput, newCollation, rel.offset, rel.fetch);
RelCollation newCollation = RexUtil.apply(mapping, oldCollation); final Sort newSort = LogicalSort.create(newInput, newCollation, rel.offset, rel.fetch);