github-actions[bot] commented on code in PR #25029: URL: https://github.com/apache/doris/pull/25029#discussion_r1341909180
########## be/src/vec/runtime/vdatetime_value.h: ########## @@ -1524,9 +1524,30 @@ class date_day_offset_dict { static constexpr int DAY_AFTER_EPOCH = 25500; // 2039-10-24 static constexpr int DICT_DAYS = DAY_BEFORE_EPOCH + DAY_AFTER_EPOCH; + static constexpr int START_YEAR = 1900; // 1900-01-01 + static constexpr int END_YEAR = 2039; // 2039-10-24 + static constexpr int DAY_OFFSET_CAL_START_POINT_DAYNR = 719527; // 1969-12-31 + + static bool can_speed_up_calc_daynr(int year) { + return year >= START_YEAR && year < END_YEAR; + } + + static int get_offset_by_daynr(int daynr) { + return daynr - DAY_OFFSET_CAL_START_POINT_DAYNR; + } + + static bool can_speed_up_daynr_to_date(int daynr) { + auto res = get_offset_by_daynr(daynr); + return res >= 0 ? res <= DAY_AFTER_EPOCH : -res <= DAY_BEFORE_EPOCH; + } + static date_day_offset_dict& get(); - DateV2Value<DateV2ValueType> operator[](int day); + static bool get_dict_init(); + + DateV2Value<DateV2ValueType> operator[](int day) const; + + int daynr(int year, int month, int day) const; Review Comment: warning: function 'daynr' should be marked [[nodiscard]] [modernize-use-nodiscard] ```suggestion [[nodiscard]] int daynr(int year, int month, int day) const; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org