private Pair<Expression, Expression> getRowCollationKey( BlockBuilder builder, PhysType inputPhysType, Group group, int windowIdx) { if (!(group.isRows || (group.upperBound.isUnbounded() && group.lowerBound.isUnbounded()))) { Pair<Expression, Expression> pair = inputPhysType.generateCollationKey( group.collation().getFieldCollations()); // optimize=false to prevent inlining of object create into for-loops return Pair.of( builder.append("keySelector" + windowIdx, pair.left, false), builder.append("keyComparator" + windowIdx, pair.right, false)); } else { return Pair.of(null, null); } }
private Pair<Expression, Expression> getRowCollationKey( BlockBuilder builder, PhysType inputPhysType, Group group, int windowIdx) { if (!(group.isRows || (group.upperBound.isUnbounded() && group.lowerBound.isUnbounded()))) { Pair<Expression, Expression> pair = inputPhysType.generateCollationKey( group.collation().getFieldCollations()); // optimize=false to prevent inlining of object create into for-loops return Pair.of( builder.append("keySelector" + windowIdx, pair.left, false), builder.append("keyComparator" + windowIdx, pair.right, false)); } else { return Pair.of(null, null); } }
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()); } }
inputPhysType.generateCollationKey( agg.call.collation.getFieldCollations()); builder.add(