xuzifu666 commented on code in PR #4371:
URL: https://github.com/apache/calcite/pull/4371#discussion_r2088287962


##########
core/src/main/java/org/apache/calcite/rel/rules/AggregateValuesRule.java:
##########
@@ -75,10 +91,18 @@ public AggregateValuesRule(RelBuilderFactory 
relBuilderFactory) {
   @Override public void onMatch(RelOptRuleCall call) {
     final Aggregate aggregate = call.rel(0);
     final Values values = call.rel(1);
-    Util.discard(values);
     final RelBuilder relBuilder = call.builder();
     final RexBuilder rexBuilder = relBuilder.getRexBuilder();
 
+    if ((aggregate.getGroupCount() != 0 || !values.getTuples().isEmpty())
+        && aggregate.groupSets.size() == 1) {
+      List<ImmutableList<RexLiteral>> distinctValues =
+          values.getTuples().stream().distinct().collect(Collectors.toList());
+      relBuilder.values(distinctValues, values.getRowType());

Review Comment:
   Here would only handle with groupSets.size = 1 condition,I had a tried seems 
ROW type can not constructor in test case. Can we just handle with Literal type 
first?Or maybe I need to think more about it. @mihaibudiu



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to