kosiew opened a new pull request, #16529: URL: https://github.com/apache/datafusion/pull/16529
## Which issue does this PR close? - Closes #16474 ## Rationale for this change The `array_has` function incorrectly returns `null` for empty arrays, which should logically return `false` since an empty array cannot contain any element. This leads to inconsistencies and incorrect query results. The change ensures that `array_has` returns the correct boolean outcome when applied to empty arrays. ## What changes are included in this PR? - Updated the `array_has_dispatch_for_scalar` function to check the array validity buffer and differentiate between null and empty arrays. - Ensured that empty arrays now return `false` and null arrays continue to return `null`. - Added SQL logic tests (`array_has_table_empty`) to verify the updated behavior. ## Are these changes tested? Yes, new test cases were added to the SQL logic test file `array.slt` to verify that: - Non-empty arrays with the target value return `true`. - Empty arrays return `false`. - Null arrays return `null`. ## Are there any user-facing changes? Yes: - `array_has([], value)` now returns `false` instead of `null`, improving correctness and predictability for users. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org