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); }
rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE).plus(newCollation), newChildRel, newCollation,
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); }
@Override public void onMatch( RelOptRuleCall call ) { SortRel rel = call.rel( 0 ); // Cascading sort does not implement limits if( rel.offset != null || rel.fetch != null ) return; RelTraitSet newTraits = rel.getTraitSet().plus( Cascading.CONVENTION ); call.transformTo( new CascadingSortRel( rel.getCluster(), newTraits, convert( rel.getChild(), newTraits ), rel.getCollation(), rel.offset, rel.fetch ) ); } }
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); }
rel.getCluster(), rel.getCluster().traitSetOf(Convention.NONE), newChildRel, newCollation);
@Override public void onMatch(RelOptRuleCall call) { final SortRel sort = call.rel(0); if (sort.offset == null && sort.fetch == null) { return; } final RelTraitSet traitSet = sort.getTraitSet().replace(EnumerableConvention.INSTANCE); RelNode input = sort.getChild(); if (!sort.getCollation().getFieldCollations().isEmpty()) { // Create a sort with the same sort key, but no offset or fetch. input = sort.copy( sort.getTraitSet(), input, sort.getCollation(), null, null); } RelNode x = convert( input, input.getTraitSet().replace(EnumerableConvention.INSTANCE)); call.transformTo( new EnumerableLimitRel( sort.getCluster(), traitSet, x, sort.offset, sort.fetch)); } }
@Override public void onMatch(RelOptRuleCall call) { final SortRel sort = call.rel(0); if (sort.offset == null && sort.fetch == null) { return; } final RelTraitSet traitSet = sort.getTraitSet().replace(EnumerableConvention.INSTANCE); RelNode input = sort.getChild(); if (!sort.getCollation().getFieldCollations().isEmpty()) { input = sort.copy( sort.getTraitSet().replace(RelCollationImpl.EMPTY), input, RelCollationImpl.EMPTY, null, null); } RelNode x = convert( input, input.getTraitSet().replace(EnumerableConvention.INSTANCE)); call.transformTo( new EnumerableLimitRel( sort.getCluster(), traitSet, x, sort.offset, sort.fetch)); } }