Skip to content
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

[breaking change] fix 265, log should be log10, and add ln #271

Merged
merged 1 commit into from
May 6, 2021

Conversation

jimexist
Copy link
Member

@jimexist jimexist commented May 5, 2021

Which issue does this PR close?

We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example Closes #123 indicates that this PR will close issue #123.

Closes #265.

Rationale for this change

Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.

What changes are included in this PR?

There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.

Are there any user-facing changes?

If there are user-facing changes then we may require documentation to be updated before approving the PR.

If there are any breaking changes to public APIs, please add the breaking change label.

@jimexist jimexist changed the title fix 265, log should be log10, and add ln request for feedback, fix 265, log should be log10, and add ln May 5, 2021
@jimexist jimexist changed the title request for feedback, fix 265, log should be log10, and add ln [request for feedback] fix 265, log should be log10, and add ln May 5, 2021
@jimexist jimexist changed the title [request for feedback] fix 265, log should be log10, and add ln [request for feedback] [breaking change] fix 265, log should be log10, and add ln May 5, 2021
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good fix personally.

I recommend we add some sort of end to end sql test that runs these functions and compares the results, but otherwise 👍 from me. Any thoughts @jorgecarleitao or @seddonm1 ?

@@ -1086,9 +1086,9 @@ unary_scalar_expr!(Trunc, trunc);
unary_scalar_expr!(Abs, abs);
unary_scalar_expr!(Signum, signum);
unary_scalar_expr!(Exp, exp);
unary_scalar_expr!(Log, ln);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we should keep a log entry / alias to log10 for postgres compatibility?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here the macro defs shall not allow dups

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely in favour of Postgres behaviour. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #275

Copy link
Member

@jorgecarleitao jorgecarleitao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, @alamb . Postgres spec ftw 👍

Thanks @jimexist for this!

@jimexist jimexist changed the title [request for feedback] [breaking change] fix 265, log should be log10, and add ln [breaking change] fix 265, log should be log10, and add ln May 6, 2021
@jimexist
Copy link
Member Author

jimexist commented May 6, 2021

@alamb I've added a test suite to make it future proof: #275

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a little spin and it looks good. Thank you @jimexist !

> CREATE EXTERNAL TABLE t(a double) STORED AS CSV LOCATION '/tmp/foo.csv';
0 rows in set. Query took 0 seconds.
> select * from t;
+---------+
| a       |
+---------+
| 1       |
| 2       |
| 3       |
| 3.14159 |
+---------+
4 row in set. Query took 0 seconds.
> select log(a), log10(a) from t;
+---------------------+---------------------+
| log(a)              | log10(a)            |
+---------------------+---------------------+
| 0                   | 0                   |
| 0.3010299956639812  | 0.3010299956639812  |
| 0.47712125471966244 | 0.47712125471966244 |
| 0.4971495058611233  | 0.4971495058611233  |
+---------------------+---------------------+

@alamb alamb merged commit f7a7505 into apache:master May 6, 2021
@jimexist jimexist deleted the fix-265 branch May 7, 2021 02:37
@houqp houqp added ballista bug Something isn't working datafusion Changes in the datafusion crate enhancement New feature or request labels Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datafusion Changes in the datafusion crate enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discrepancy in the meaning of log function
5 participants