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

[CALCITE-6688] Allow operators of SqlKind.SYMMETRICAL to be reversed. #4062

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tjbanghart
Copy link
Contributor

SqlBasicFunction did not override SqlOperator#reverse() so functions belonging to the SqlKind.SYMMETRICAL set threw a NPE during normalization.

This PR adds a overridden reverse() method to SqlBasicFunction that returns the operator if isSymmetrical() is true.

@tjbanghart tjbanghart changed the title [CALCITE-6688] Allow basic symmetric operators to be reversed. [CALCITE-6688] Allow symmetric basic functions to be reversed. Nov 22, 2024
@mihaibudiu
Copy link
Contributor

You need some unit tests.
You should reconcile the JIRA title with this one.

@tjbanghart
Copy link
Contributor Author

Could you suggest another good test class to add to? There are some in core/src/test/java/org/apache/calcite/rex/RexNormalizeTest.java

@tjbanghart tjbanghart changed the title [CALCITE-6688] Allow symmetric basic functions to be reversed. [CALCITE-6688] Allow symmetrical SqlBasicFunctions functions to be reversed. Nov 22, 2024
@mihaibudiu
Copy link
Contributor

It would be great to have a test that reproduces the NPE that is mentioned in the JIRA issue.

@tjbanghart tjbanghart changed the title [CALCITE-6688] Allow symmetrical SqlBasicFunctions functions to be reversed. [CALCITE-6688] Allow operators of SqlKind.SYMMETRICAL to be reversed. Nov 22, 2024
@tjbanghart tjbanghart force-pushed the calcite-6688 branch 2 times, most recently from e16feb9 to 0f20939 Compare December 2, 2024 21:07
@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Dec 2, 2024
Copy link

sonarcloud bot commented Dec 4, 2024

@mihaibudiu
Copy link
Contributor

@NobiGo I will let you approve and merge this when you think you are happy with the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM-will-merge-soon Overall PR looks OK. Only minor things left.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants