[
https://issues.apache.org/jira/browse/CALCITE-6259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17816858#comment-17816858
]
Caican Cai edited comment on CALCITE-6259 at 2/13/24 3:37 AM:
--------------------------------------------------------------
[~julianhyde]
There is no log2 feature in postgres, but as far as I know, only spark and
mysql have log2.
I agree with you that we don't need to add a different log function for each
dialect, maybe adding an enumeration value is a good idea
was (Author: JIRAUSER302115):
[~julianhyde] There is no log2 function in postgres, but as far as I know, only
spark and mysql have log2 functions.
I agree with you that we don't need to add a different log function for each
dialect, we use the log function of Math in java to implement the log function,
so log10(0) is -Infinity, and when negative it is double.NaN.
In postgres, log10(-10) returns an error, while mysql returns null. I think we
can do nothing about negative numbers.
Maybe the debate right now is what do you do with log10(0)
> The implementation of the Log library operator does not match the actual
> dialect behavior.
> ------------------------------------------------------------------------------------------
>
> Key: CALCITE-6259
> URL: https://issues.apache.org/jira/browse/CALCITE-6259
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.36.0
> Reporter: Caican Cai
> Priority: Major
> Fix For: 1.37.0
>
> Attachments: 302662660-27b21670-5364-463c-b6dc-d750c46d7cd1.png,
> 302663876-91173a60-695d-409e-b325-3f91655c6d0d.png,
> image-2024-02-12-21-52-45-462.png
>
>
> The implementation of the Log library operator does not match the actual
> dialect behavior.
> For example, when log10(0) returns null in mysql and spark, but log10(0)
> returns error in postgres, neither is calcite's -Intity
> {code:java}
> postgres=# select log10(0);
> ERROR: cannot take logarithm of zero
> postgres=# select log(2,0);
> ERROR: cannot take logarithm of zero
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)