gstvg commented on PR #18921:
URL: https://github.com/apache/datafusion/pull/18921#issuecomment-3658471081

   Hi @fbx31, reduce is supported too. It isn't included here because it's 
implementation is not as simple as array_transform and would make this PR even 
bigger. But if any reviewer/maintainer request it we can add it and make sure 
it works since the beginning.
   
   [Nesting is supported, some tests already cover 
it](https://github.com/gstvg/arrow-datafusion/blob/b18d2145163fb5933dfed55eb6305412743b6cac/datafusion/sqllogictest/test_files/lambda.slt#L44-L47)
   
   With the new approach you need to use lambda_col("current_value") instead of 
col("current_value"):
   
   ```rust
   df.with_column(
       "new_col",
       array_transform(
           col("my_array"),
           lambda(
               vec!["current_value"], // define the parameters name 
               lambda_col("current_value") * 2 // the lambda body
           )
       )
   )
   ```
   SQL equivalent:
   ```sql
    array_transform(my_array, current_value -> current_value * 2)
   ```
   
   No worries, feel free to ask any questions you have 


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