andygrove opened a new issue, #4560:
URL: https://github.com/apache/datafusion-comet/issues/4560

   ## Description
   
   `array_size(NULL)` should return `NULL`, but Comet returns `-1`.
   
   `array_size` is `RuntimeReplaceable` and lowers to `Size(child, 
legacySizeOfNull = false)`. With `legacySizeOfNull = false`, Spark returns 
`NULL` for a NULL input; with `legacySizeOfNull = true` it returns `-1`. 
Comet's native `Size` implementation appears to always return `-1` for NULL, 
ignoring the `legacySizeOfNull = false` case.
   
   Found while sweeping `RuntimeReplaceable` functions for Comet support (the 
query runs natively via `CometProject`, so it does not fall back; it just 
returns the wrong value).
   
   ## Likely broader impact
   
   The same `legacySizeOfNull = false` path is used by `size` and `cardinality` 
(whose flag comes from `spark.sql.legacy.sizeOfNull`, default `false` in modern 
Spark), so they may exhibit the same NULL-handling bug. Worth verifying.
   
   ## Repro (SQL)
   
   ```sql
   SELECT array_size(CAST(NULL AS ARRAY<INT>));  -- Spark: NULL, Comet: -1
   ```
   
   ## Expected
   
   Match Spark: return `NULL` when `legacySizeOfNull = false` and the input is 
NULL.


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