peterxcli opened a new pull request, #4726: URL: https://github.com/apache/datafusion-comet/pull/4726
## Which issue does this PR close? No issue for this, relate to: https://github.com/apache/datafusion-comet/pull/4716 ## Rationale for this change Comet previously evaluated all `ArrayInsert` children for the full batch. This differed from Spark, which evaluates arguments left-to-right and does not evaluate the position or inserted item when the source array is `NULL`. > > This caused expressions such as `element_at(array(1), 0)` to be evaluated even though Spark would short-circuit and return `NULL` for the row. > > This patch uses DataFusion’s `evaluate_selection` in the native `ArrayInsert` implementation to skip evaluating `pos` and `item` for rows where the source array is `NULL`. It also adds regression coverage for both `array_insert` and `array_prepend`, since Spark rewrites `array_prepend` to `array_insert(..., 1, ...)`. ## What changes are included in this PR? argument parsing logic in `array_insert` batch execution. ## How are these changes tested? - `./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite array_prepend" -Dtest=none` - `./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite array_insert" -Dtest=none` -- 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]
