erenavsarogullari opened a new pull request, #20469: URL: https://github.com/apache/datafusion/pull/20469
## Which issue does this PR close? - Closes #20466. ## Rationale for this change Currently, Spark `slice` function accepts Null Arrays and return `Null` for this particular queries. DataFusion-Spark `slice` function also needs to return `NULL` when Null Array is set. **Spark Behavior** (tested with latest Spark master): ``` > SELECT slice(NULL, 1, 2); +-----------------+ |slice(NULL, 1, 2)| +-----------------+ | null| +-----------------+ ``` **DF Behaviour:** Current: ``` query error SELECT slice(NULL, 1, 2); ---- DataFusion error: Internal error: could not cast array of type Null to arrow_array::array::list_array::GenericListArray<i32>. This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues ``` New: ``` query ? SELECT slice(NULL, 1, 2); ---- NULL ``` ## What changes are included in this PR? Explained under first section. ## Are these changes tested? Added new UT cases for both `slice.rs` and `slice.slt`. ## Are there any user-facing changes? Yes, currently, `slice` function returns error message for `Null` Array inputs, however, expected behavior is to be returned `NULL` so end-user will get expected result instead of error message. -- 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]
