ViktorBystrov72 opened a new pull request, #60526: URL: https://github.com/apache/spark/pull/60526
### What changes were proposed in this pull request? Normalize FLOAT and DOUBLE zero values before inserting them into the frequent-items sketch used by `approx_top_k` and `approx_top_k_accumulate`. Add buffer and SQL regressions and a migration note. ### Why are the changes needed? [SPARK-61527](https://issues.apache.org/jira/browse/SPARK-61527) reports that positive and negative zero become separate sketch keys even though Spark SQL groups them as equal. With two rows, `+0.0` and `-0.0`, and sufficient sketch capacity, the result incorrectly contains two items with count 1. ### Does this PR introduce _any_ user-facing change? Yes. The two signs of zero now produce one zero-valued item with count 2. This also applies when accumulating and combining newly created sketches. Recompute persisted sketches to apply the new grouping. ### How was this patch tested? All 16 new regression tests failed on the original implementation. - Full Catalyst `ApproxTopKSuite`: 35 tests passed, covering direct updates and serialized partial merges for FLOAT/DOUBLE in both input orders. - Full SQL `ApproxTopKSuite`: 217 tests passed. New cases cover direct aggregation, accumulation/estimation and combination, with one and three partitions and nonzero, NaN, infinity and null controls. - Catalyst production/test and SQL test ScalaStyle: passed. - Apache RAT: passed with the repository exclusions plus the `.git` worktree metadata file. The SQL suite emitted a possible-daemon-thread-leak warning also seen in the baseline run; the patched checks exited successfully. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-6; exact tool build unavailable). Codex assisted with the implementation, tests, migration note, and this description. -- 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]
