Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Support date and time function: week #757

Merged

Conversation

rupal-bq
Copy link
Contributor

Issue #709

Description of changes:
Added implementation, unit test, manual IT, and doc updates for function week()

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Rupal Mahajan added 10 commits September 18, 2020 17:26
…ime-function-week

# Conflicts:
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/DSL.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/datetime/DateTimeFunction.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/function/BuiltinFunctionName.java
#	core/src/test/java/com/amazon/opendistroforelasticsearch/sql/expression/datetime/DateTimeFunctionTest.java
Rupal Mahajan added 2 commits September 28, 2020 09:58
…ime-function-week

# Conflicts:
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/data/model/ExprStringValue.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/DSL.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/datetime/DateTimeFunction.java
#	core/src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/function/BuiltinFunctionName.java
#	docs/user/dql/functions.rst
#	integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/ppl/DateTimeFunctionIT.java
#	ppl/src/main/antlr/OpenDistroPPLParser.g4
#	sql/src/main/antlr/OpenDistroSQLParser.g4
Copy link
Member

@chloe-zh chloe-zh left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the changes!

* Returns week number for date according to mode.
* @param mode Integer for mode. Valid mode values are 0 to 7.
*/
public int getWeekNumber(int mode) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could this function be static to avoid consturct CalendarLookup every time?
e.g. getWeekNumber(ExprValue date, ExprValue mode)
then define getCalendar(int firstDayOfWeek, int minimalDaysInWeek, Supplier dateProvider)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. added this change.

Copy link
Contributor

@penghuo penghuo 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 the change.

@chloe-zh chloe-zh merged commit d75b7f1 into opendistro-for-elasticsearch:develop Sep 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants