-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add EXTRACT
Function To OpenSearch SQL Plugin
#1421
Add EXTRACT
Function To OpenSearch SQL Plugin
#1421
Conversation
* Added Basic Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Lexer And Parser Language Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation And Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Modified Implementation And Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Checkstyle Issues Signed-off-by: GabeFernandez310 <[email protected]> * Added Javadoc comments and Tests Signed-off-by: GabeFernandez310 <[email protected]> * Changed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Changed A Test Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Integration Tests Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Extract Tests Into New File Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Tests Signed-off-by: GabeFernandez310 <[email protected]> * Renamed Rule In Parser Signed-off-by: GabeFernandez310 <[email protected]> * Fixed AstExpressionBuilder Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]>
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1421 +/- ##
=========================================
Coverage 98.38% 98.39%
- Complexity 3698 3706 +8
=========================================
Files 343 343
Lines 9121 9169 +48
Branches 586 586
=========================================
+ Hits 8974 9022 +48
Misses 142 142
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
LGMT
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFormatterUtil.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/ExtractTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/datetime/DateTimeFunctionTest.java
Outdated
Show resolved
Hide resolved
6780052
Signed-off-by: GabeFernandez310 <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1421-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 87018c654ed648615984071203fa9016d4c414f5
# Push it to GitHub
git push --set-upstream origin backport/backport-1421-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
) * Add `EXTRACT` Function To OpenSearch SQL Plugin * Added Basic Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Lexer And Parser Language Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation And Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Modified Implementation And Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Checkstyle Issues Signed-off-by: GabeFernandez310 <[email protected]> * Added Javadoc comments and Tests Signed-off-by: GabeFernandez310 <[email protected]> * Changed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Changed A Test Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Integration Tests Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Extract Tests Into New File Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Tests Signed-off-by: GabeFernandez310 <[email protected]> * Renamed Rule In Parser Signed-off-by: GabeFernandez310 <[email protected]> * Fixed AstExpressionBuilder Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> * Removed Unneeded Code And Added Parser Test Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> (cherry picked from commit 87018c6)
* Add `EXTRACT` Function To OpenSearch SQL Plugin * Added Basic Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Lexer And Parser Language Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation And Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Modified Implementation And Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Checkstyle Issues Signed-off-by: GabeFernandez310 <[email protected]> * Added Javadoc comments and Tests Signed-off-by: GabeFernandez310 <[email protected]> * Changed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Changed A Test Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Integration Tests Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Extract Tests Into New File Signed-off-by: GabeFernandez310 <[email protected]> * Refactored Tests Signed-off-by: GabeFernandez310 <[email protected]> * Renamed Rule In Parser Signed-off-by: GabeFernandez310 <[email protected]> * Fixed AstExpressionBuilder Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> * Removed Unneeded Code And Added Parser Test Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> (cherry picked from commit 87018c6)
Description
Adds the
EXTRACT
function to the SQL plugin, aligned with the MySQL documentation. Extract(part FROM date) returns a number formatted according to what is defined by the temporal interval being used for the part argument. A list of the MySQL temporal intervals can be found here.Example:
Extract(DAY FROM "2023-02-11 10:11:12.123")
->11
Extract(DAY SECOND_MICROSECOND "2023-02-11 10:11:12.123")
->12123000
Issues Resolved
722
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.