You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "stuartcarnie (via GitHub)" <gi...@apache.org> on 2023/02/06 23:47:03 UTC

[GitHub] [arrow-datafusion] stuartcarnie opened a new issue, #5206: Add SQL function overload log(b,x) for logarithm of x to base b

stuartcarnie opened a new issue, #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   As a user, I would like to determine the logarithm of a value, $x$ to base $b$.
   
   **Describe the solution you'd like**
   
   Add an overload to the `log` function, which takes two arguments. Using PostgreSQL for inspiration per [the documentation](https://www.postgresql.org/docs/current/functions-math.html):
   
   > `log ( b numeric, x numeric ) → numeric`
   > Logarithm of $x$ to base $b$
   > log(2.0, 64.0) → 6.0000000000000000  
   
   **Describe alternatives you've considered**
   
   DataFusion strives for PostgreSQL compatibility, so it makes sense to use the PostgreSQL solution.
   
   **Additional context**
   


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

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


[GitHub] [arrow-datafusion] stuartcarnie commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "stuartcarnie (via GitHub)" <gi...@apache.org>.
stuartcarnie commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425012018

   In the case of the `LOG` function, if there is a single argument, it is assumed to be LOG $x$ base 10:
   
   > ```
   > log ( numeric ) → numeric
   > log ( double precision ) → double precision
   >      Base 10 logarithm
   >      log(100) → 2
   ```


-- 
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] comphead commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425007441

   @alamb on top of my head we dont have overloaded scalar functions yet? 
   We know how to to create different aliases for the same function, but not overloading


-- 
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 closed issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base
URL: https://github.com/apache/arrow-datafusion/issues/5206


-- 
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] stuartcarnie commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "stuartcarnie (via GitHub)" <gi...@apache.org>.
stuartcarnie commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425022133

   @comphead awesome, thanks for doing 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] comphead commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425011893

   Thanks @stuartcarnie with `log` I came out to the similar solution, inspecting `len()` :) but was wondering if we already have something more elegant to provide default values, seems we dont have it yet


-- 
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] stuartcarnie commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "stuartcarnie (via GitHub)" <gi...@apache.org>.
stuartcarnie commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425012606

   @comphead no worries – I looked for other solutions too, but that is all I could find for now.
   


-- 
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] stuartcarnie commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "stuartcarnie (via GitHub)" <gi...@apache.org>.
stuartcarnie commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425009998

   @comphead there are already examples in DF of this, for example the `ltrim` function takes 1 or 2 arguments:
   
   https://github.com/apache/arrow-datafusion/blob/ac876dbc9729b16e272e00496c51e53d9f649173/datafusion/physical-expr/src/string_expressions.rs#L355-L369


-- 
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] comphead commented on issue #5206: Add SQL function overload `LOG(base, x)` for logarithm of x to base

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on issue #5206:
URL: https://github.com/apache/arrow-datafusion/issues/5206#issuecomment-1425015548

   Thats okay, I'll implement it using `len()` but going forward probably we may want to think how we can substitute default values, in case of different signatures for the same scalar function


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