Add SQL function overload LOG(base, x) for logarithm of x to base#5245
Add SQL function overload LOG(base, x) for logarithm of x to base#5245alamb merged 4 commits intoapache:masterfrom
Conversation
|
@stuartcarnie @alamb with whereas PostgresSQL doesn't allow queries like that and fail the query |
For anyone else who is curious, here is what postgres does with this query: postgres=# select log(0);
ERROR: cannot take logarithm of zero
postgres=# select log(1, 64);
ERROR: division by zero |
|
Thank you very much for this contribution @comphead |
@alamb would you like to solve edgecases as part of this PR or another one? |
A different one, please |
| # under the License. | ||
|
|
||
| ############# | ||
| ## Scalar Tests |
There was a problem hiding this comment.
| ## Scalar Tests | |
| ## Scalar Function Tests |
| # log scalar nulls 2 | ||
| query IT rowsort | ||
| select log(null, null) a, log(null) b | ||
| ---- |
There was a problem hiding this comment.
Can you please add the test cases you identified in the PR here (log(0), log(1, 64)) as well to document the behavior and also file a ticket to document the discrepancy?
|
Thanks @comphead -- this looks really great. cc @stuartcarnie |
|
Looks great, thanks @comphead 🙏 I tried to look at the source of PostgreSQL, to see the implementation of their |
|
Thanks again @comphead |
|
Benchmark runs are scheduled for baseline = 0f95966 and contender = 8a609dc. 8a609dc is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #5206 .
Rationale for this change
Add SQL function overload LOG(base, x) for logarithm of x to base
What changes are included in this PR?
Are these changes tested?
Test included
Are there any user-facing changes?
No