andygrove opened a new issue, #424: URL: https://github.com/apache/datafusion-spark/issues/424
### Describe the bug `width_bucket` returns NULL when `value` is `Infinity` or `-Infinity`. Spark returns `num_bucket + 1` for `Infinity` and `0` for `-Infinity`. Spark's `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. The `Float64` kernel here nulls any value that is not finite, including `value` ([width_bucket.rs#L254](https://github.com/apache/datafusion-spark/blob/ab9d308e4ee504dbd3a9731abfc3519f937c86d1/crates/spark/src/function/math/width_bucket.rs#L254)). ### To Reproduce ```sql SELECT width_bucket(CAST('Infinity' AS DOUBLE), CAST(0.0 AS DOUBLE), CAST(10.0 AS DOUBLE), CAST(5 AS BIGINT)), width_bucket(CAST('-Infinity' AS DOUBLE), CAST(0.0 AS DOUBLE), CAST(10.0 AS DOUBLE), CAST(5 AS BIGINT)); ``` datafusion-spark returns `NULL NULL`. ### Expected behavior As in Spark: ``` 6 0 ``` A NaN `value` should still return NULL, and it does in both. ### Spark versions Checked on PySpark 4.2.0 and 3.5.9, which give the same result. ### datafusion-spark version main at ab9d308 ### Additional context Found while reviewing #414. -- 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]
