yadavay-amzn opened a new pull request, #56910: URL: https://github.com/apache/spark/pull/56910
### What changes were proposed in this pull request? Add `TimeType` support to cost-based optimizer (CBO) statistics estimation so range-based selectivity, join, and union estimation work for TIME columns. `TimeType` (stored as nanoseconds-of-day in a Long) is handled at every site the other fixed-width temporal types use - `EstimationUtils.toDouble/fromDouble`, `FilterEstimation.evaluateBinary/evaluateInSet`, `UnionEstimation.isTypeSupported`, and `CatalogColumnStat` min/max external-string (de)serialization (via `TimeFormatter`) - mirroring the existing `TimestampType` (micros-as-Long) handling. ### Why are the changes needed? Before this, filters/joins/unions over a TIME column fell back to default selectivity because `TimeType` was not among the types CBO estimates, yielding poor row-count estimates and plans. TIME maps cleanly to a numeric scale (nanos-of-day), so it can be estimated the same way as DATE/TIMESTAMP. ### Does this PR introduce _any_ user-facing change? No. (Affects plan costing/estimates only, not query results.) ### How was this patch tested? New `FilterEstimationSuite` tests for TIME range/equality/IN selectivity (asserting exact `rowCount`/`distinctCount`/`min`/`max`), and extended `JoinEstimationSuite`/`UnionEstimation` tests with TIME columns. All existing CBO estimation tests pass; scalastyle clean. ### Was this patch authored or co-authored using generative AI tooling? Authored with assistance by Claude Opus 4.8. -- 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]
