danny0405 commented on a change in pull request #1835: [CALCITE-3830] The
‘approximate’ field should be considered when computing the digest of
AggregateCall
URL: https://github.com/apache/calcite/pull/1835#discussion_r385005652
##########
File path: core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java
##########
@@ -292,9 +292,15 @@ public AggregateCall rename(String name) {
}
public String toString() {
- StringBuilder buf = new StringBuilder(aggFunction.toString());
+ StringBuilder buf = new StringBuilder();
+ // currently approximate = true is only for 'APPROX_COUNT_DISTINCT'
+ if (approximate && distinct) {
+ buf.append("APPROX_COUNT_DISTINCT");
+ } else {
Review comment:
Agreed with Julian, we should not modify the agg call name which is a unique
identifier of the function, better to add some distinct flag to the Aggregate
digest instead:
```java
public RelWriter explainTerms(RelWriter pw) {
// We skip the "groups" element if it is a singleton of "group".
super.explainTerms(pw)
.item("group", groupSet)
.itemIf("groups", groupSets, getGroupType() != Group.SIMPLE)
.itemIf("aggs", aggCalls, pw.nest());
if (!pw.nest()) {
for (Ord<AggregateCall> ord : Ord.zip(aggCalls)) {
pw.item(Util.first(ord.e.name, "agg#" + ord.i), ord.e);
}
}
return pw;
}
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services