You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add SQL function overload LOG(base, x) for logarithm of x to base #5206
changed the title [-]Add SQL function overload log(b,x) for logarithm of x to base b[/-][+]Add SQL function overload `LOG(x, base)` for logarithm of $x$ to base $b$[/+]on Feb 9, 2023
changed the title [-]Add SQL function overload `LOG(x, base)` for logarithm of $x$ to base $b$[/-][+]Add SQL function overload `LOG(x, base)` for logarithm of x to base[/+]on Feb 9, 2023
changed the title [-]Add SQL function overload `LOG(x, base)` for logarithm of x to base[/-][+]Add SQL function overload `LOG(base, x)` for logarithm of x to base[/+]on Feb 9, 2023
@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
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
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
Activity
[-]Add SQL function overload log(b,x) for logarithm of x to base b[/-][+]Add SQL function overload `LOG(x, base)` for logarithm of $x$ to base $b$[/+][-]Add SQL function overload `LOG(x, base)` for logarithm of $x$ to base $b$[/-][+]Add SQL function overload `LOG(x, base)` for logarithm of x to base[/+][-]Add SQL function overload `LOG(x, base)` for logarithm of x to base[/-][+]Add SQL function overload `LOG(base, x)` for logarithm of x to base[/+]comphead commentedon Feb 10, 2023
@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
stuartcarnie commentedon Feb 10, 2023
@comphead there are already examples in DF of this, for example the
ltrimfunction takes 1 or 2 arguments:https://github.com/apache/arrow-datafusion/blob/ac876dbc9729b16e272e00496c51e53d9f649173/datafusion/physical-expr/src/string_expressions.rs#L355-L369
comphead commentedon Feb 10, 2023
Thanks @stuartcarnie with
logI came out to the similar solution, inspectinglen():) but was wondering if we already have something more elegant to provide default values, seems we dont have it yetstuartcarnie commentedon Feb 10, 2023
In the case of the$x$ base 10:
LOGfunction, if there is a single argument, it is assumed to be LOGstuartcarnie commentedon Feb 10, 2023
@comphead no worries – I looked for other solutions too, but that is all I could find for now.
comphead commentedon Feb 10, 2023
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 functionstuartcarnie commentedon Feb 10, 2023
@comphead awesome, thanks for doing that!