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 Day_Of_Month Function As An Alias Of DayOfMonth #194

Conversation

GabeFernandez310
Copy link

Description

Adds support for the day_of_month function as an alias for the dayofmonth function which currently exists in opensearch

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 <gabrielf@bitquilltech.com>
@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

❗ No coverage uploaded for pull request base (integ-add-day_of_month-function-alt@7edc72e). Click here to learn what that means.
The diff coverage is n/a.

@@                          Coverage Diff                           @@
##             integ-add-day_of_month-function-alt     #194   +/-   ##
======================================================================
  Coverage                                       ?   95.83%           
  Complexity                                     ?     3544           
======================================================================
  Files                                          ?      356           
  Lines                                          ?     9402           
  Branches                                       ?      674           
======================================================================
  Hits                                           ?     9010           
  Misses                                         ?      334           
  Partials                                       ?       58           
Flag Coverage Δ
query-workbench 62.76% <0.00%> (?)
sql-engine 98.31% <0.00%> (?)

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

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

@GabeFernandez310 GabeFernandez310 requested a review from a team December 19, 2022 20:02
);
}

public void testInvalidDayOfMonth(String date) {

Choose a reason for hiding this comment

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

private

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in 878a6a1

@@ -430,6 +430,64 @@ public void dayOfMonth() {
assertEquals(integerValue(8), eval(expression));
}

public void testDayOfMonthWithUnderscores(FunctionExpression dateExpression, int dayOfMonth) {

Choose a reason for hiding this comment

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

private

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in 878a6a1

Description
>>>>>>>>>>>

Usage: day_of_month(date) extracts the day of the month for date, in the range 1 to 31. The dates with value 0 such as '0000-00-00' or '2008-00-00' are invalid.

Choose a reason for hiding this comment

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

nit: This seems obvious, but I see that it was included in the synonym functions...
If you'd like, we could remove it from all of the functions.

The dates with value 0 such as '0000-00-00' or '2008-00-00' are invalid.

Copy link
Author

Choose a reason for hiding this comment

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

I agree it's kind of obvious. I will remove it for now and in my PR upstream just add it back in if Amazon wants it back.

Copy link
Author

Choose a reason for hiding this comment

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

Addressed in 878a6a1

| 26 |
+------------------------------+

os> SELECT DAY_OF_MONTH(DATE('2020-08-26'))

Choose a reason for hiding this comment

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

all of these similar tests are covered by IT tests. We can just have the one example in the documentation.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 878a6a1

Copy link

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

One small fix

sql/src/main/antlr/OpenSearchSQLParser.g4 Outdated Show resolved Hide resolved
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
@GabeFernandez310
Copy link
Author

One small fix

Addressed in 878a6a1

Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
@GabeFernandez310 GabeFernandez310 requested review from Yury-Fridlyand and removed request for MitchellGale December 27, 2022 18:35
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
@GabeFernandez310 GabeFernandez310 merged commit 4c13198 into integ-add-day_of_month-function-alt Jan 5, 2023
GabeFernandez310 added a commit that referenced this pull request Jan 5, 2023
Added Implementation And Testing For Day_Of_Month Function

Signed-off-by: GabeFernandez310 <gabrielf@bitquilltech.com>
Yury-Fridlyand pushed a commit that referenced this pull request Jan 10, 2023
…ct#1227)

* Add Day_Of_Month Function As An Alias Of DayOfMonth (#194)

Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
matthewryanwells pushed a commit that referenced this pull request Feb 1, 2023
…ct#1227)

* Add Day_Of_Month Function As An Alias Of DayOfMonth (#194)

Signed-off-by: GabeFernandez310 <Gabriel.Fernandez@improving.com>
(cherry picked from commit 1108379)
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