rubenada commented on code in PR #6523:
URL: https://github.com/apache/hive/pull/6523#discussion_r3785750385


##########
ql/src/test/results/clientpositive/perf/tpcds30tb/json/query30.q.out:
##########
@@ -1947,7 +1947,7 @@
             "name": null
           }
         ],
-        "rowCount": 36000000

Review Comment:
   This should be consequence of 
[CALCITE-7083](https://issues.apache.org/jira/browse/CALCITE-7083) 
"RelMdDistinctRowCount aggregates implementation problems", specifically this 
check that bails out and returns the agg rowcount as a most conservative 
estimate:
   
   ```
     public @Nullable Double getDistinctRowCount(Aggregate rel, 
RelMetadataQuery mq,
         ImmutableBitSet groupKey, @Nullable RexNode predicate) {
       ...
       // the result of the aggregation function is difficult to infer, so if 
the groupKey contains
       // the aggregated column, return the full row count of Aggregate. This 
is the most conservative
       // estimate, and the actual ndv will not be greater than it.
       if (groupKey.anyMatch(key -> key >= rel.getGroupCount())) {
         return mq.getRowCount(rel);
       }
       ...
   ```
   Since we have a sequence of Aggregate - Project - Aggregate, the top-most 
aggregate should compute its rowcount based on the distinctRowCount of its 
input (Project), which should, in turn, call the distinctRowCount of its input 
(bottom Aggregate), so the alteration of the `getDistinctRowCount` for 
Aggregate propagates from there.
   The increase seems huge, but if you compare it with the rowcount of the 
surrounding operators (e.g. the input Project-Aggregate), it seems on the same 
order of magnitude.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to