new SortRel( cluster, cluster.traitSetOf(Convention.NONE, collation),
public SortRel copy( RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, RexNode offset, RexNode fetch) { assert traitSet.containsIfApplicable(Convention.NONE); return new SortRel( getCluster(), traitSet, newInput, newCollation, offset, fetch); }
public SortRel copy( RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, RexNode offset, RexNode fetch) { assert traitSet.contains(Convention.NONE); return new SortRel( getCluster(), traitSet, newInput, newCollation, offset, fetch); }
new SortRel( cluster, cluster.traitSetOf(Convention.NONE, collation),
new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE).plus(newCollation),
new SortRel( cluster, cluster.traitSetOf(Convention.NONE, collation),
public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation == RelCollationImpl.PRESERVE) { return null; } 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 SortRel sort = new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE, toCollation), rel, toCollation); RelNode newRel = sort; final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(sort, newTraitSet); } return newRel; }
new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE),
public RelNode convert( RelOptPlanner planner, RelNode rel, RelCollation toCollation, boolean allowInfiniteCostConverters) { if (toCollation == RelCollationImpl.PRESERVE) { 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 SortRel sort = new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE, toCollation), rel, toCollation); RelNode newRel = sort; final RelTraitSet newTraitSet = rel.getTraitSet().replace(toCollation); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(sort, newTraitSet); } return newRel; }
private static RelNode fromMutable(MutableRel node) { switch (node.type) { case SCAN: case VALUES: return ((MutableLeafRel) node).rel; case PROJECT: final MutableProject project = (MutableProject) node; return new ProjectRel(node.cluster, node.cluster.traitSetOf(RelCollationImpl.EMPTY), fromMutable(project.input), project.projects, project.rowType, ProjectRelBase.Flags.BOXED); case FILTER: final MutableFilter filter = (MutableFilter) node; return new FilterRel(node.cluster, fromMutable(filter.input), filter.condition); case AGGREGATE: final MutableAggregate aggregate = (MutableAggregate) node; return new AggregateRel(node.cluster, fromMutable(aggregate.input), aggregate.groupSet, aggregate.aggCalls); case SORT: final MutableSort sort = (MutableSort) node; return new SortRel(node.cluster, node.cluster.traitSetOf(sort.collation), fromMutable(sort.input), sort.collation, sort.offset, sort.fetch); case UNION: final MutableUnion union = (MutableUnion) node; return new UnionRel(union.cluster, fromMutables(union.inputs), union.all); default: throw new AssertionError(node.deep()); } }
public void rewriteRel(SortRel rel) { RelCollation oldCollation = rel.getCollation(); final RelNode oldChild = rel.getChild(); 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"); } } SortRel newRel = new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE), newChild, RexUtil.apply(mapping, oldCollation)); setNewForOldRel(rel, newRel); }
public void rewriteRel(SortRel rel) { RelCollation oldCollation = rel.getCollation(); final RelNode oldChild = rel.getChild(); 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); SortRel newRel = new SortRel( rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE).plus(newCollation), newChild, newCollation, rel.offset, rel.fetch); setNewForOldRel(rel, newRel); }