You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/10 08:50:34 UTC

[GitHub] [arrow-datafusion] Jimexist opened a new issue #305: Allow ScalarFunctionImplementation to take more than just args

Jimexist opened a new issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305


   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   A challenge to allow `ScalarFunctionImplementation` to take more than just the `vec` of `columnar` values, because in case of no-arg functions like `random()`, there's no way to tell the desired output array length.
   
   **Describe the solution you'd like**
   A clear and concise description of what you want to happen.
   
   change
   
   ```rust
   /// Scalar function
   pub type ScalarFunctionImplementation =
       Arc<dyn Fn(ScalarFunctionArgs) -> Result<ColumnarValue> + Send + Sync>;
   ```
   
   to something like
   
   ```rust
   /// Scalar function
   pub type ScalarFunctionImplementation =
       Arc<dyn Fn(ScalarFunctionArgs) -> Result<ColumnarValue> + Send + Sync>;
   ```
   
   ```rust
   /// Scalar function
   pub type ScalarFunctionImplementation =
       Arc<dyn Fn(usize, ScalarFunctionArgs) -> Result<ColumnarValue> + Send + Sync>;
   ```
   
   where the first param `usize` is the batch size
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] Jimexist commented on issue #305: Allow ScalarFunctionImplementation to take more than just args

Posted by GitBox <gi...@apache.org>.
Jimexist commented on issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305#issuecomment-836448630


   @jorgecarleitao thanks for the advice. did you mean these two bullets combined as a solution?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb closed issue #305: Allow execution of zero parameter functions

Posted by GitBox <gi...@apache.org>.
alamb closed issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] jorgecarleitao commented on issue #305: Allow ScalarFunctionImplementation to take more than just args

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305#issuecomment-836456326


   They are independent solutions: 
   
   In the former, we have a new `PhysicalExpr`, that executes evaluates in a different way (by passing the length to the function)
   
   In the latter, the planner would query the number of arguments of the expression, and if it is zero, would pass a `NullArray` to it (I do not have the exact solution atm).
   
   In my opinion this issue should be written in a generic form, so that it focus on the problem and not on the solution. E.g. instead of "Allow ScalarFunctionImplementation to...", use "Allow execution of zero-argument functions".
   
   It is not obvious to me that changing the signature of `ScalarFunctionImplementation` is the right approach here.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] Jimexist commented on issue #305: Allow ScalarFunctionImplementation to take more than just args

Posted by GitBox <gi...@apache.org>.
Jimexist commented on issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305#issuecomment-836468050


   > It is not obvious to me that changing the signature of ScalarFunctionImplementation is the right approach here.
   Agree on this.
   
   Let me rephrase


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] jorgecarleitao commented on issue #305: Allow ScalarFunctionImplementation to take more than just args

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305#issuecomment-836439179


   Some alternatives:
   
   * create a node for these type of operations.
   
   * have the physical planner pass a `NullArray` to functions of zero arguments; `NullArray` has a length (only has a length).


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb closed issue #305: Allow execution of zero parameter functions

Posted by GitBox <gi...@apache.org>.
alamb closed issue #305:
URL: https://github.com/apache/arrow-datafusion/issues/305


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org