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

Add WEEKDAY Function to SQL Plugin #234

Merged
merged 12 commits into from
Mar 9, 2023

Conversation

GabeFernandez310
Copy link

@GabeFernandez310 GabeFernandez310 commented Feb 24, 2023

Description

Adds the weekday function to the SQL plugin. The function accepts a DATE/TIME/DATETIME/TIMESTAMP/STRING and returns an index 0-6 (Monday-Sunday) for the corresponding weekday the date lands on. If a TIME is used the function uses the current day. This is based on MySQL docs.

Examples:
SELECT weekday('2020-08-27') -> 3

Issues Resolved

722

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
@codecov
Copy link

codecov bot commented Feb 24, 2023

Codecov Report

Merging #234 (87c3f9e) into integ-add-weekday-function (259b001) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                      Coverage Diff                      @@
##             integ-add-weekday-function     #234   +/-   ##
=============================================================
  Coverage                         98.38%   98.38%           
- Complexity                         3693     3697    +4     
=============================================================
  Files                               343      343           
  Lines                              9107     9119   +12     
  Branches                            585      585           
=============================================================
+ Hits                               8960     8972   +12     
  Misses                              142      142           
  Partials                              5        5           
Flag Coverage Δ
sql-engine 98.38% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/main/java/org/opensearch/sql/expression/DSL.java 100.00% <100.00%> (ø)
...arch/sql/expression/datetime/DateTimeFunction.java 100.00% <100.00%> (ø)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
Signed-off-by: GabeFernandez310 <[email protected]>
@GabeFernandez310 GabeFernandez310 marked this pull request as ready for review March 1, 2023 22:49
Signed-off-by: GabeFernandez310 <[email protected]>
@GabeFernandez310 GabeFernandez310 merged commit 0a1c823 into integ-add-weekday-function Mar 9, 2023
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.

5 participants