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/12/27 13:02:01 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue #1493: Implement `power` function

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


   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   We would like to compute a power function (like `2**4` = `2 * 2 * 2 * 2`) in datafusion
   
   @matthewmturner  asks for it here: https://github.com/apache/arrow-datafusion/issues/147#issuecomment-1001223018
   
   **Describe the solution you'd like**
   
   Implement the `power` function as described in https://www.postgresql.org/docs/14/functions-math.html
   
   ```
   power ( a numeric, b numeric ) → numeric
   power ( a double precision, b double precision ) → double precision
   
   a raised to the power of b
   
   power(9, 3) → 729
   ```
   
   **Describe alternatives you've considered**
   It may also be interesting to investigate adding support for `a**b` as another way to write the same thing
   
   **Additional context**
   This is probably a good ticket to learn about the datafusion codebase and its function implementations -- one could follow the example of one of the existing functions in 
   
   https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/physical_plan/functions.rs
   


-- 
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-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] matthewmturner commented on issue #1493: Implement `power` function

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


   ill work on this


-- 
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-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] matthewmturner commented on issue #1493: Implement `power` function

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


   ive started looking into this and i think it makes sense to add `power` / `power_scalar` compute kernels to arrow first then expose it in `physical_plan/expressions/binary.rs` and `physical_plan/expressions/functions.rs`
   
   @alamb ok with that?


-- 
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-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] matthewmturner commented on issue #1493: Implement `power` function

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


   @alamb ok happy to do that. 
   
   but just to show you where i was coming from, i saw both C++ (https://arrow.apache.org/docs/cpp/compute.html#arithmetic-functions) and arrow2 (https://github.com/jorgecarleitao/arrow2/blob/main/src/compute/arithmetics/basic/pow.rs) had kernels for power.  so i thought we would want to do something similar and not have datafusion implement something that could / should be done downstream.


-- 
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-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] alamb commented on issue #1493: Implement `power` function

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


   @matthewmturner  -- I don't have a strong preference.


-- 
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-unsubscribe@arrow.apache.org

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



[GitHub] [arrow-datafusion] alamb commented on issue #1493: Implement `power` function

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


   @matthewmturner  I think `power` is more like a `function` rather than an `operator` -- so in that case I think you could just add `power` to `BuiltinScalarFunction` (and then fill in the implementation):
   
   https://github.com/apache/arrow-datafusion/blob/5668be78a9ccbf5469e9e95ad070920ca5d105ba/datafusion/src/physical_plan/functions.rs


-- 
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-unsubscribe@arrow.apache.org

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