public Result implement(EnumerableRelImplementor implementor, Prefer pref) { final BlockBuilder builder = new BlockBuilder(); final EnumerableRel child = (EnumerableRel) getInput(); final Result result = implementor.visitChild(this, 0, child, pref); final PhysType physType = PhysTypeImpl.of( implementor.getTypeFactory(), getRowType(), result.format); Expression childExp = builder.append("child", result.block); PhysType inputPhysType = result.physType; final Pair<Expression, Expression> pair = inputPhysType.generateCollationKey( collation.getFieldCollations()); builder.add( Expressions.return_(null, Expressions.call(childExp, BuiltInMethod.ORDER_BY.method, Expressions.list( builder.append("keySelector", pair.left)) .appendIfNotNull( builder.appendIfNotNull("comparator", pair.right))))); return implementor.result(physType, builder.toBlock()); } }
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { final BlockBuilder builder = new BlockBuilder(); final EnumerableRel child = (EnumerableRel) getInput(); final Result result = implementor.visitChild(this, 0, child, pref); final PhysType physType = PhysTypeImpl.of( implementor.getTypeFactory(), getRowType(), result.format); Expression childExp = builder.append("child", result.block); PhysType inputPhysType = result.physType; final Pair<Expression, Expression> pair = inputPhysType.generateCollationKey( collation.getFieldCollations()); builder.add( Expressions.return_(null, Expressions.call(childExp, BuiltInMethod.ORDER_BY.method, Expressions.list( builder.append("keySelector", pair.left)) .appendIfNotNull( builder.appendIfNotNull("comparator", pair.right))))); return implementor.result(physType, builder.toBlock()); } }