Michael-J-Ward opened a new issue, #10424:
URL: https://github.com/apache/datafusion/issues/10424

   ### Describe the bug
   
   The `array_slice` UDF takes 4 parameters.
   
   
https://github.com/apache/datafusion/blob/96487ea0cbb7901a1e4aa18fdf6deb8961319fea/datafusion/functions-array/src/extract.rs#L55-L61
   
   Which means that `args.len()` is always 4 in `array_slice_inner`, even when 
called with `stride = Expr::Null` or `stride = Expr::Int64(None)`
   
   
https://github.com/apache/datafusion/blob/96487ea0cbb7901a1e4aa18fdf6deb8961319fea/datafusion/functions-array/src/extract.rs#L289-L293
   
   ### To Reproduce
   
   I encountered this while creating the python wrapper for `datafusion-python` 
and had to set `stride=1` else the function would panic.
   
   
https://github.com/apache/datafusion-python/blob/7ad526caf140f7eb76ec541c903027d49693b58f/src/functions.rs#L104-L111
   
   ### Expected behavior
   
   The `stride` behavior in the UDF should match what's available in the CLI
   
   ```
   CREATE TEMPORARY VIEW data3 AS VALUES ([1.0, 2.0, 3.0, 3.0]), ([4.0, 5.0, 
3.0]), ([6.0]);
   ❯ select * from data3;
   +----------------------+
   | column1              |
   +----------------------+
   | [1.0, 2.0, 3.0, 3.0] |
   | [4.0, 5.0, 3.0]      |
   | [6.0]                |
   +----------------------+
   
   > select * from array_slice(data3.column1, -1, 2)
   +-----------------------------------------------+
   | array_slice(data3.column1,Int64(-1),Int64(2)) |
   +-----------------------------------------------+
   | []                                            |
   | []                                            |
   | [6.0]                                         |
   +-----------------------------------------------+
   ```
   
   
   ### Additional context
   
   _No response_


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

Reply via email to