okumin commented on code in PR #6505:
URL: https://github.com/apache/hive/pull/6505#discussion_r4585835486


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistinctRowCount.java:
##########
@@ -61,6 +63,12 @@ public Double getDistinctRowCount(HiveTableScan htRel, 
RelMetadataQuery mq, Immu
     List<ColStatistics> colStats = htRel.getColStat(projIndxLst);
     Double noDistinctRows = 1.0;
     for (ColStatistics cStat : colStats) {
+      // unknown (< 0) or zero NDV yields 0; null (Calcite's
+      // "unknown") would need matching guards in
+      // HiveRelMdRowCount's PK-FK analysis

Review Comment:
   What if this returns null? Does it require major surgery, or do existing 
tests go wrong? Still, this change is better than returning a negative number.



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