hsyuan commented on a change in pull request #1985: URL: https://github.com/apache/calcite/pull/1985#discussion_r431184692
########## File path: core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java ########## @@ -86,4 +99,65 @@ public Result implement(EnumerableRelImplementor implementor, Prefer pref) { // EnumerableCalcRel is always better throw new UnsupportedOperationException(); } + + @Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( + RelTraitSet required) { + RelCollation collation = required.getCollation(); + if (collation == null) { + return null; + } + + final Mappings.TargetMapping map = + RelOptUtil.permutationIgnoreCast( + getProjects(), getInput().getRowType()); + if (checkIfSortIsDefinedOnNonTrivalExpr(map, collation)) { + return null; + } + + final RelCollation newCollation = collation.apply(map); + return Pair.of(required, ImmutableList.of(required.replace(newCollation))); + } + + @Override public Pair<RelTraitSet, List<RelTraitSet>> deriveTraits( + final RelTraitSet childTraits, final int childId) { + RelCollation collation = childTraits.getCollation(); + if (collation == null) { + return null; + } + + final Mappings.TargetMapping map = + RelOptUtil.permutationIgnoreCast( + getProjects(), getInput().getRowType()); + if (checkIfSortIsDefinedOnNonTrivalExpr(map, collation)) { + return null; Review comment: For the last 2 negative test cases, I think you already have similar ones in your test. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org