andygrove opened a new pull request, #3172:
URL: https://github.com/apache/datafusion-comet/pull/3172

   ## Summary
   - Adds native Comet support for Spark's `array_position` function
   - Returns the 1-based position of an element in an array, or 0 if not found
   
   ## Implementation Details
   This required a custom Rust implementation because DataFusion's 
`array_position` returns `UInt64` and `null` when not found, while Spark 
returns `Int64` (LongType) and `0`.
   
   Key implementation details:
   - Returns `Int64` to match Spark's `LongType`
   - Returns `0` when element is not found (Spark behavior)
   - Returns `null` when array is `null` or search element is `null`
   - Supports both `List` and `LargeList` array types
   
   ## Test Plan
   - Added unit tests for `array_position` in `CometArrayExpressionSuite`
   - Tests cover:
     - Finding elements in integer arrays
     - Finding elements in string arrays
     - Element not found (returns 0)
     - Arrays with null elements
     - Column-based queries (not just literals)
   - All existing tests pass
   
   > **Note:** This PR was generated with AI assistance.
   
   Closes #3153


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