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-6015] AssertionError during optimization of EXTRACT expression #3435

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

mihaibudiu
Copy link
Contributor

While attempting to fix the bug described in the issue I have discovered that many cases for EXTRACT are actually not implemented. So I implemented most of them, and I have improved the validation as well; the case indicated in the JIRA issue will now be rejected statically.

There is one case for EXTRACT which I haven't implemented: EXTRACT(EPOCH FROM INTERVAL '...' YEAR TO MONTH) because I wasn't sure how to properly use the convertlets to do it. Help would be appreciated.

This PR also makes some unexpected tiny changes in SqlValidatorImpl and SqlCall, so I would appreciate comments from people who are more knowledgeable.

@sonarcloud
Copy link

sonarcloud bot commented Sep 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

98.3% 98.3% Coverage
0.0% 0.0% Duplication

Copy link

sonarcloud bot commented Dec 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

98.3% 98.3% Coverage
0.0% 0.0% Duplication

@mihaibudiu
Copy link
Contributor Author

This PR implements several instances of the EXTRACT function which weren't supported. I would appreciate a review.

@mihaibudiu
Copy link
Contributor Author

Can anyone please review this PR?

site/_docs/history.md Outdated Show resolved Hide resolved
@rubenada
Copy link
Contributor

rubenada commented Mar 9, 2024

Thanks @mihaibudiu , no further comment from my side. LGTM.

@mihaibudiu
Copy link
Contributor Author

Squashed the commits in preparation for merging.

site/_docs/history.md Outdated Show resolved Hide resolved
@rubenada
Copy link
Contributor

Thanks @mihaibudiu !
@snuyanzin do you have any further remark? Otherwise IMO this PR is in a good shape to be merged.

Copy link
Contributor

@snuyanzin snuyanzin left a comment

Choose a reason for hiding this comment

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

Thanks for asking
and thanks for addressing comments
it looks ok from my side

f.checkFails("^extract(decade from time '12:34:56')^", fail, false);
f.checkFails("^extract(century from time '12:34:56')^", fail, false);
f.checkFails("^extract(century from time '12:34:56')^", fail, false);
f.checkFails("^extract(century from time '12:34:56')^", fail, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

noticed some duplicated tests, I will delete these before merging.

Copy link

sonarcloud bot commented Mar 21, 2024

@mihaibudiu mihaibudiu merged commit 4823cb7 into apache:main Mar 21, 2024
17 checks passed
@mihaibudiu mihaibudiu deleted the issue6015 branch March 21, 2024 18:16
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.

3 participants