vaidik787 opened a new pull request, #426:
URL: https://github.com/apache/datafusion-spark/pull/426

   <!--
   SPDX-License-Identifier: Apache-2.0
   SPDX-FileCopyrightText: See the NOTICE file distributed with this work for 
additional information regarding copyright ownership
   SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under 
one or more contributor license agreements
   -->
   
   ## Which issue does this PR close?
   
   - Closes #424.
   
   ## Rationale for this change
   
   `width_bucket` returns NULL when the value is `Infinity` or `-Infinity`. 
Spark returns `num_buckets + 1` for `Infinity` and `0` for `-Infinity`, because 
`WidthBucket.computeBucketNumber` returns NULL only for a NaN value, and for a 
NaN or infinite `min` or `max`. An infinite value is handled by the normal 
below-min and above-max checks.
   
   ## What changes are included in this PR?
   
   - The Float64 kernel now returns NULL for a NaN value only, instead of for 
any value that is not finite. The bounds must still be finite.
   - The function documentation says so, and `docs/functions/scalar/math.md` is 
regenerated with `dev/update_function_docs.sh`.
   
   ## Are these changes tested?
   
   Yes. `math/width_bucket.slt` has new cases for `Infinity` and `-Infinity` as 
the value, with `min < max` and `min > max`, and for an infinite `min` and 
`max`. Without the kernel change the infinite-value cases return NULL; with it 
the whole `width_bucket.slt` passes, both with and without `simplify`.
   
   The expected results are the ones in #424, which reports PySpark 4.2.0 and 
3.5.9. I did not run Spark myself. I also ran `cargo fmt --all`, `cargo clippy 
--all-targets --all-features -- -D warnings` and `cargo test -p 
datafusion-spark-sqllogictest`.
   
   ## Are there any user-facing changes?
   
   Yes. `width_bucket` now returns Spark's result for an infinite value instead 
of NULL.
   
   ---
   
   AI assistance: this change was prepared with Claude Code.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01LjXwp6RG3FDtC4t3PqLCQs
   


-- 
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]

Reply via email to