-
Notifications
You must be signed in to change notification settings - Fork 0
Add Support For TIME Type in "*_OF_YEAR" Functions
#199
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
Changes from 13 commits
847b904
cf3ef86
a7b55c9
e787dff
9d88361
2b01f81
9245498
08608d5
85c93e6
2926623
8eea630
eac4b4e
4d4afa5
6465ec8
2517b31
109af62
3c843ba
c664af7
dcbe2e2
2d8049f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,6 +82,9 @@ public class DateTimeFunction { | |||||||||||||
| // 32536771199.999999, or equivalent '3001-01-18 23:59:59.999999' UTC | ||||||||||||||
| private static final Double MYSQL_MAX_TIMESTAMP = 32536771200d; | ||||||||||||||
|
|
||||||||||||||
| // Mode used for week/week_of_year function by default when no argument is provided | ||||||||||||||
| private static final ExprIntegerValue DEFAULT_WEEK_OF_YEAR_MODE = new ExprIntegerValue(0); | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Register Date and Time Functions. | ||||||||||||||
| * | ||||||||||||||
|
|
@@ -368,6 +371,8 @@ private DefaultFunctionResolver dayOfWeek() { | |||||||||||||
| */ | ||||||||||||||
| private DefaultFunctionResolver dayOfYear(BuiltinFunctionName dayOfYear) { | ||||||||||||||
| return define(dayOfYear.getName(), | ||||||||||||||
| implWithProperties((functionProperties, arg) -> DateTimeFunction.dayOfYearToday( | ||||||||||||||
| functionProperties.getQueryStartClock()), INTEGER, TIME), | ||||||||||||||
| impl(nullMissingHandling(DateTimeFunction::exprDayOfYear), INTEGER, DATE), | ||||||||||||||
| impl(nullMissingHandling(DateTimeFunction::exprDayOfYear), INTEGER, DATETIME), | ||||||||||||||
| impl(nullMissingHandling(DateTimeFunction::exprDayOfYear), INTEGER, TIMESTAMP), | ||||||||||||||
|
|
@@ -441,6 +446,8 @@ private DefaultFunctionResolver minute() { | |||||||||||||
| */ | ||||||||||||||
| private DefaultFunctionResolver month(BuiltinFunctionName month) { | ||||||||||||||
| return define(month.getName(), | ||||||||||||||
| implWithProperties((functionProperties, arg) -> DateTimeFunction.monthOfYearToday( | ||||||||||||||
| functionProperties.getQueryStartClock()), INTEGER, TIME), | ||||||||||||||
|
||||||||||||||
| implWithProperties((functionProperties, arg) -> DateTimeFunction.monthOfYearToday( | |
| functionProperties.getQueryStartClock()), INTEGER, TIME), | |
| implWithProperties(nullMissingHandlingWithProperties((functionProperties, arg) -> DateTimeFunction.monthOfYearToday( | |
| functionProperties.getQueryStartClock())), INTEGER, TIME), |
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.
Fixed in 6465ec8
Outdated
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.
| implWithProperties((functionProperties, arg) -> DateTimeFunction.weekOfYearToday( | |
| DEFAULT_WEEK_OF_YEAR_MODE, | |
| functionProperties.getQueryStartClock()), INTEGER, TIME), | |
| implWithProperties(nullMissingHandlingWithProperties((functionProperties, arg) -> DateTimeFunction.weekOfYearToday( | |
| DEFAULT_WEEK_OF_YEAR_MODE, | |
| functionProperties.getQueryStartClock())), INTEGER, TIME), |
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.
Fixed in 6465ec8
Outdated
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.
| implWithProperties((functionProperties, time, modeArg) -> DateTimeFunction.weekOfYearToday( | |
| modeArg, | |
| functionProperties.getQueryStartClock()), INTEGER, TIME, INTEGER), | |
| implWithProperties(nullMissingHandlingWithProperties((functionProperties, time, modeArg) -> DateTimeFunction.weekOfYearToday( | |
| modeArg, | |
| functionProperties.getQueryStartClock())), INTEGER, TIME, INTEGER), |
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.
Fixed in 2517b31
Outdated
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.
You can avoid extra actions made in formatNow
| return new ExprIntegerValue((formatNow(clock).getDayOfYear())); | |
| return new ExprIntegerValue(LocalDateTime.now(clock).getDayOfYear()); |
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.
Fixed in 2517b31
Outdated
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.
| CalendarLookup.getWeekNumber(mode.integerValue(), formatNow(clock).toLocalDate())); | |
| CalendarLookup.getWeekNumber(mode.integerValue(), LocalDateTime.now(clock).toLocalDate())); |
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.
Fixed in 2517b31
Outdated
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.
| return new ExprIntegerValue((formatNow(clock).getMonthValue())); | |
| return new ExprIntegerValue(LocalDateTime.now(clock).getMonthValue()); |
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.
Fixed in 2517b31
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.
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.
Fixed in 6465ec8