jcamachor commented on a change in pull request #1786: URL: https://github.com/apache/hive/pull/1786#discussion_r547066579
########## File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java ########## @@ -2553,7 +2553,10 @@ private void updateColStats(HiveConf conf, Statistics stats, long leftUnmatchedR = HiveConf.getBoolVar(conf, ConfVars.HIVE_STATS_JOIN_NDV_READJUSTMENT); long newDV = oldDV; if (useCalciteForNdvReadjustment) { - newDV = RelMdUtil.numDistinctVals(oldDV * 1.0, newNumRows * 1.0).longValue(); + Double approxNdv = RelMdUtil.numDistinctVals(oldDV * 1.0, newNumRows * 1.0); + if (approxNdv != null) { Review comment: We should probably add a precondition so we fail it if is null. Otherwise, we will basically not scale the value silently, which is neither the new behavior or the old behavior. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org