xuzifu666 commented on code in PR #4371:
URL: https://github.com/apache/calcite/pull/4371#discussion_r2097491457
##########
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:
```
doesn't the field you group on need to be the same that is aggregated as
well?
where is that check?
VALUES can contain ROW objects.
```
@mihaibudiu had added check for rowType. Need to be same with that is
aggregated.
--
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]