yyanyy opened a new pull request, #60428: URL: https://github.com/apache/spark/pull/60428
### What changes were proposed in this pull request? Use `SQLOrderingUtil.compareDoubles` when inserting, merging and compressing quantile summaries so NaN values follow Spark SQL ordering. Add summary-level regressions and a SQL regression with explicit input partitions for both `percentile_approx` and `approx_percentile`. ### Why are the changes needed? Ordinary floating-point comparisons are false for NaN. They can misorder merged samples and drop a sample during compression while keeping its count, corrupting quantile ranks and endpoints. ### Does this PR introduce _any_ user-facing change? Yes. Approximate percentiles containing NaN now respect Spark SQL's NaN-last ordering across partition layouts. For inputs `[1,2,3,4]` and `[NaN]` in separate partitions, percentiles `[0,0.5,1]` previously returned `[1,3,4]`; they now return `[1,3,NaN]`. ### How was this patch tested? The new summary and SQL regressions both failed on the original code before the production change. Validation uses a fresh SBT build with JDK 21: - Full `QuantileSummariesSuite` and `ApproximatePercentileSuite`. - Percentile tests in `DataFrameAggregateSuite`, including both aliases, both partition orders and one partition. - `approxQuantile` tests in `DataFrameStatSuite`. - Catalyst production/test and SQL test Scala style checks. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-6) -- 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]
