konstantinb commented on PR #6505: URL: https://github.com/apache/hive/pull/6505#issuecomment-7178030448
> wouldn't it be cleaner and more future-proof to use something more special than negative values to state that the NDV is unknown? E.g., OptionalLong? @thomasrebele I agree it would be cleaner: with `OptionalLong` the compiler forces every reader to handle the unknown case, and the bugs this PR fixes are exactly arithmetic on the sentinel. I'd still keep -1 here: - `numNulls`, `numTrues` and `numFalses` in the same class already use negative = unknown (HIVE-29438); switching only `countDistinct` would make `ColStatistics` inconsistent. - Converting all four is a refactor of its own: about 140 reads in 21 files in `ql`, and `ColStatistics` is part of the public `StatEstimator` interface that UDFs implement (including in iceberg-handler), so it changes an extension API. - The metastore keeps a sentinel anyway: Thrift `numDVs` is a required `i64`, and stored -1 values exist. - Where an API defines a special value, this PR uses it: unknown is now `null` at the Calcite boundary. I'd propose a follow-up JIRA that converts the four fields together, possibly keeping deprecated `long` getters for a while. -- 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]
