weizuo93 opened a new pull request #8412: URL: https://github.com/apache/incubator-doris/pull/8412
# Proposed changes Issue Number: close #xxx ## Problem Summary: Support function `INT YEARWEEK(DATE date, INT week_start, INT day_in_first_week)`. * Returns year and week for the input date. * The parameter `week_start` means the start day of a week, which value is between 1 and 7,as is shown in following table: |week_start|meaning| |:-----:|:-----| |1|Monday is the first day in a week| |2|Tuesday is the first day in a week| |3|Wednesday is the first day in a week| |4|Thursday is the first day in a week| |5|Friday is the first day in a week| |6|Saturday is the first day in a week| |7|Sunday is the first day in a week| * The parameter `day_in_first_week` means which day in January belongs to first week,which value is between 1 and 7, as is shown in following table: |day_in_first_week|meaning| |:-----:|:-----| |1|The week including January 1st is the first week in the year| |2|The week including January 2nd is the first week in the year| |3|The week including January 3rd is the first week in the year| |4|The week including January 4th is the first week in the year| |5|The week including January 5th is the first week in the year| |6|The week including January 6th is the first week in the year| |7|The week including January 7th is the first week in the year| For example: ``` mysql> select yearweek('2022-1-1', 1, 1); +---------------------------------------+ | yearweek('2022-01-01 00:00:00', 1, 1) | +---------------------------------------+ | 202201 | +---------------------------------------+ ``` ``` mysql> select yearweek('2022-1-1', 1, 3); +---------------------------------------+ | yearweek('2022-01-01 00:00:00', 1, 3) | +---------------------------------------+ | 202153 | +---------------------------------------+ ``` ``` mysql> select yearweek('2021-12-29', 1, 1); +---------------------------------------+ | yearweek('2021-12-29 00:00:00', 1, 1) | +---------------------------------------+ | 202201 | +---------------------------------------+ ``` ## Checklist(Required) 1. Does it affect the original behavior: No 2. Has unit tests been added: Yes 3. Has document been added or modified: Yes 4. Does it need to update dependencies: No 5. Are there any changes that cannot be rolled back: No -- 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