Skip to content

Commit

Permalink
Support day, hour, minute, month, year, second, weekofyear, dayofmont…
Browse files Browse the repository at this point in the history
…h, dayofyear, dayofweek function. (apache#54)
  • Loading branch information
HappenLee committed Aug 10, 2021
1 parent c1ed00d commit 332786d
Show file tree
Hide file tree
Showing 10 changed files with 964 additions and 13 deletions.
2 changes: 2 additions & 0 deletions be/src/runtime/datetime_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class DateTimeValue {

int year() const { return _year; }
int month() const { return _month; }
int quarter() const { return (_month - 1) / 3 + 1; }
int day() const { return _day; }
int hour() const { return _hour; }
int minute() const { return _minute; }
Expand Down Expand Up @@ -310,6 +311,7 @@ class DateTimeValue {

// Weekday, from 0(Mon) to 6(Sun)
inline uint8_t weekday() const { return calc_weekday(daynr(), false); }
inline auto day_of_week() const { return (weekday() + 1) % 7 + 1; }

// The bits in week_format has the following meaning:
// WEEK_MONDAY_FIRST (0)
Expand Down
2 changes: 2 additions & 0 deletions be/src/vec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ set(VEC_FILES
functions/divide.cpp
functions/is_null.cpp
functions/is_not_null.cpp
functions/to_time_function.cpp
functions/time_of_function.cpp
sink/mysql_result_writer.cpp
sink/result_sink.cpp
sink/vdata_stream_sender.cpp
Expand Down
Loading

0 comments on commit 332786d

Please sign in to comment.