-
Notifications
You must be signed in to change notification settings - Fork 180
Add YEARWEEK Function To OpenSearch SQL
#1417
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 YEARWEEK Function To OpenSearch SQL
#1417
Conversation
* Added Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Addressed PR Comments Signed-off-by: GabeFernandez310 <[email protected]> * Cleaned YearweekTest File Signed-off-by: GabeFernandez310 <[email protected]> * Added Tests and Fixed Docs Signed-off-by: GabeFernandez310 <[email protected]> * Added And Modified Unit Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Jacoco In Core Signed-off-by: GabeFernandez310 <[email protected]> * Reworked convertWeekModeFromMySqlToJava Function Signed-off-by: GabeFernandez310 <[email protected]> * Refactored To Remove Extra Function 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 #1417 +/- ##
=========================================
Coverage 98.38% 98.39%
- Complexity 3693 3708 +15
=========================================
Files 343 343
Lines 9107 9148 +41
Branches 585 587 +2
=========================================
+ Hits 8960 9001 +41
Misses 142 142
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Show resolved
Hide resolved
acarbonetto
left a comment
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.
LGTM
core/src/main/java/org/opensearch/sql/expression/datetime/DateTimeFunction.java
Show resolved
Hide resolved
Signed-off-by: GabeFernandez310 <[email protected]>
d4fba47
|
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-1417-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 03e4f97b4f41074d9bf79584a36a56bf90ee221c
# Push it to GitHub
git push --set-upstream origin backport/backport-1417-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.xThen, create a pull request where the |
|
@GabeFernandez310 please, backport manually |
* Add `YEARWEEK` Function To OpenSearch SQL * Added Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Addressed PR Comments Signed-off-by: GabeFernandez310 <[email protected]> * Cleaned YearweekTest File Signed-off-by: GabeFernandez310 <[email protected]> * Added Tests and Fixed Docs Signed-off-by: GabeFernandez310 <[email protected]> * Added And Modified Unit Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Jacoco In Core Signed-off-by: GabeFernandez310 <[email protected]> * Reworked convertWeekModeFromMySqlToJava Function Signed-off-by: GabeFernandez310 <[email protected]> * Refactored To Remove Extra Function Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Magic Number Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> (cherry picked from commit 03e4f97)
* Add `YEARWEEK` Function To OpenSearch SQL * Added Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Addressed PR Comments Signed-off-by: GabeFernandez310 <[email protected]> * Cleaned YearweekTest File Signed-off-by: GabeFernandez310 <[email protected]> * Added Tests and Fixed Docs Signed-off-by: GabeFernandez310 <[email protected]> * Added And Modified Unit Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Jacoco In Core Signed-off-by: GabeFernandez310 <[email protected]> * Reworked convertWeekModeFromMySqlToJava Function Signed-off-by: GabeFernandez310 <[email protected]> * Refactored To Remove Extra Function Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Magic Number Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> (cherry picked from commit 03e4f97)
* Add `YEARWEEK` Function To OpenSearch SQL * Added Tests Signed-off-by: GabeFernandez310 <[email protected]> * Added Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Implementation Signed-off-by: GabeFernandez310 <[email protected]> * Added Documentation Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Tests Signed-off-by: GabeFernandez310 <[email protected]> * Addressed PR Comments Signed-off-by: GabeFernandez310 <[email protected]> * Cleaned YearweekTest File Signed-off-by: GabeFernandez310 <[email protected]> * Added Tests and Fixed Docs Signed-off-by: GabeFernandez310 <[email protected]> * Added And Modified Unit Tests Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Jacoco In Core Signed-off-by: GabeFernandez310 <[email protected]> * Reworked convertWeekModeFromMySqlToJava Function Signed-off-by: GabeFernandez310 <[email protected]> * Refactored To Remove Extra Function Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> * Fixed Magic Number Signed-off-by: GabeFernandez310 <[email protected]> --------- Signed-off-by: GabeFernandez310 <[email protected]> (cherry picked from commit 03e4f97)
Description
The
yearweek(date [, mode])function accepts a first argument representing a date, and an optional second argument containing a mode. It extract the year and week of the year from the input argument, and formats it as an integer which is returned. If an argument of typeTIMEis provided, the current date is used. The mode argument defines a set of rules to decide how to parse the year and week of the year and are based on MySQL.Example:
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.