hsyuan commented on a change in pull request #1918: [CALCITE-3926] CannotPlanException when an empty LogicalValues requires a certain collation URL: https://github.com/apache/calcite/pull/1918#discussion_r409054562
########## File path: core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValues.java ########## @@ -65,6 +65,19 @@ public static EnumerableValues create(RelOptCluster cluster, return new EnumerableValues(cluster, rowType, tuples, traitSet); } + /** Creates an EnumerableValues. */ + public static EnumerableValues create(Values input) { + final RelOptCluster cluster = input.getCluster(); + final ImmutableList<ImmutableList<RexLiteral>> tuples = input.getTuples(); + final RelDataType rowType = input.getRowType(); + final RelTraitSet traitSet = + input.getTraitSet() + .replace(EnumerableConvention.INSTANCE) + .replaceIf(RelDistributionTraitDef.INSTANCE, + () -> RelMdDistribution.values(rowType, tuples)); + return new EnumerableValues(cluster, rowType, tuples, traitSet); + } Review comment: Instead of doing this, can we just modify copy(traitset, inputs) method to just return `new EnumerableValues(getCluster(), rowType, tuples, traitSet);`? ---------------------------------------------------------------- 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 With regards, Apache Git Services