Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/vec/runtime/vdatetime_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ uint32_t VecDateTimeValue::year_week(uint8_t mode) const {
// not covered by year_week_table, calculate at runtime
uint32_t year = 0;
// The range of the week in the year_week is 1-53, so the mode WEEK_YEAR is always true.
uint8_t week = calc_week(*this, mode | 2, &year);
uint8_t week = calc_week(*this, mode | 2, &year, true);
// When the mode WEEK_FIRST_WEEKDAY is not set,
// the week in which the last three days of the year fall may belong to the following year.
if (week == 53 && day() >= 29 && !(mode & 4)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,30 @@ February
-- !sql --
202026

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
198912

-- !sql --
200

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ suite("test_date_function") {
// YEARWEEK
qt_sql """ select yearweek('2021-1-1') """
qt_sql """ select yearweek('2020-7-1') """
qt_sql """ select yearweek('1989-03-21', 0) """
qt_sql """ select yearweek('1989-03-21', 1) """
qt_sql """ select yearweek('1989-03-21', 2) """
qt_sql """ select yearweek('1989-03-21', 3) """
qt_sql """ select yearweek('1989-03-21', 4) """
qt_sql """ select yearweek('1989-03-21', 5) """
qt_sql """ select yearweek('1989-03-21', 6) """
qt_sql """ select yearweek('1989-03-21', 7) """

qt_sql """ select count(*) from (select * from numbers("200")) tmp1 WHERE 0 <= UNIX_TIMESTAMP(); """

Expand Down