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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants