andygrove commented on code in PR #414: URL: https://github.com/apache/datafusion-spark/pull/414#discussion_r4711203801
########## crates/sqllogictest/test_files/math/width_bucket.slt: ########## @@ -95,3 +95,9 @@ query I SELECT width_bucket(INTERVAL '1' YEAR, INTERVAL '5' YEAR, INTERVAL '5' YEAR, 10) ---- NULL + +# Spark treats numBucket == Long.MaxValue as null (WidthBucket.isNull) +query I +SELECT width_bucket(5.0, 0.0, 10.0, 9223372036854775807); +---- +NULL Review Comment: The new query goes through the `Float64` kernel. Could you add a case for the `bucket_from_f64` guard as well? `INTERVAL '1' YEAR` literals plan as `MonthDayNano`, which is the path that uses it. For example: ``` query II SELECT width_bucket(INTERVAL '1' YEAR, INTERVAL '0' YEAR, INTERVAL '5' YEAR, CAST(9223372036854775807 AS BIGINT)), width_bucket(INTERVAL '1' DAY, INTERVAL '0' DAY, INTERVAL '5' DAY, CAST(9223372036854775807 AS BIGINT)); ---- NULL NULL query I SELECT width_bucket(v, CAST(0.0 AS DOUBLE), CAST(10.0 AS DOUBLE), n) FROM (VALUES (CAST(5.0 AS DOUBLE), CAST(9223372036854775807 AS BIGINT)), (CAST(5.0 AS DOUBLE), CAST(3 AS BIGINT)), (CAST(NULL AS DOUBLE), CAST(9223372036854775807 AS BIGINT))) t(v, n); ---- NULL 2 NULL ``` Both match PySpark 4.2.0 and pass on this branch. The first one panics on `main`. -- 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]
