-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minior: Add negative tests about log function #9245
Conversation
@alamb Hello, I have a question about logX(0). In arrow-datafusion, logX(0) returns -Infinity. From a mathematical point of view, I think there is no problem. However, I tested that mysql returns null and postgres returns error. , consider modifying the arrow-datafusion part. |
On a similar note the log with base zero returns zero ❯ select log(0, 3);
+------------------------+
| log(Int64(0),Int64(3)) |
+------------------------+
| 0.0 |
+------------------------+
Mathematically that's undefined, while in Postgres/DuckDB it leads to an error ( |
I think log2, log10, and log should be the same set of functions, which is fine, and maybe we all feel that the current handling of log10(0) could be improved |
FYI some relevant previous discussion/work on log: |
Thank you for your reply. I'm sorry that I didn't notice the content in the document before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @caicancai for adding the tests to document this feature more fully in code
I am hoping this type of "what should log
do in corner cases" will have a better story once we have done #8045 -- and thus if someone wants a different set of log
function behavior they can just register a different log
UDF
so cool, I think this is a very good idea, as a single sql engine can output the corresponding result expected by the user according to the user's custom behavior, which means that we do not need to adapt the negative test of each function in any dialect, but only need to concentrate on adapting most of the common functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks @caicancai
Which issue does this PR close?
Fractions in the log function are an important test because the results of 2.0/3 and 2/3 are completely different
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?