asolimando opened a new issue, #21111: URL: https://github.com/apache/datafusion/issues/21111
## Is your feature request related to a problem or challenge? In #21077, we set `distinct_count` to `Exact(1)` when a filter predicate collapses a column interval to a single value. This works for numeric types (Int8, Int16, Int32, Int64, UInt32, Float32, Float64) but not for temporal types (Timestamp, Interval, Duration). Despite [`next_value_helper()`](https://github.com/apache/datafusion/blob/f734ec54dc1b93b964bd69cfeca725b117f16244/datafusion/expr-common/src/interval_arithmetic.rs#L1233) having implementations for these types, the constraint propagation solver does not collapse equality predicates on temporal columns to single-value intervals. For example, `WHERE ts = '2021-01-01T00:00:00'` should produce NDV=Exact(1) but currently stays at the original Inexact NDV. ## Describe the solution you'd like Investigate why interval analysis does not collapse temporal equality predicates despite `next_value` support, and fix the root cause. Alternatively, detect equality predicates directly in [`collect_new_statistics`](https://github.com/apache/datafusion/blob/f734ec54dc1b93b964bd69cfeca725b117f16244/datafusion/physical-plan/src/filter.rs#L808), bypassing interval analysis for the NDV computation. ## Describe alternatives you've considered The direct equality detection approach proposed in #21109 (for strings) could also cover temporal types in one pass. ## Additional context - Part of #20766 - Related: #21077 (NDV=Exact(1) for numeric types), #21109 (string types) -- 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]
