[MCOL-1389] EXTRACT(WEEK FROM CDATE) returned 1 based week number, instead of 0 based Created: 2018-05-04 Updated: 2022-11-05 Resolved: 2022-11-05 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | N/A |
| Affects Version/s: | 1.1.4 |
| Fix Version/s: | Icebox, 1.4.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Lee (Inactive) | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Build tested: 1.1.4-1 -----------
-----------
----------- |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2018-05-04 ] | ||||||||
|
Documentation bug. See code:
| ||||||||
| Comment by David Hall (Inactive) [ 2018-05-07 ] | ||||||||
|
From PostGreSQL The number of the week of the year that the day is in. By definition (ISO 8601), the first week of a year contains January 4 of that year. (The ISO-8601 week starts on Monday.) In other words, the first Thursday of a year is in week 1 of that year. (for timestamp values only) Because of this, it is possible for early January dates to be part of the 52nd or 53rd week of the previous year. For example, 2005-01-01 is part of the 53rd week of year 2004, and 2006-01-01 is part of the 52nd week of year 2005. From Oracle WEEK (1 - 53) Returns the rank of the week in the year, where the first week starts on the first day of the year. From these, I conclude that EXTRACT(WEEK..) should return a 1 based number. | ||||||||
| Comment by Daniel Lee (Inactive) [ 2018-05-07 ] | ||||||||
|
I was comparing the MariaDB server and assumed MariaDB is correct. Does that mean a bug in the server? or we are just going with different standard. I even compared results for days in May and they are off by 1. | ||||||||
| Comment by David Hall (Inactive) [ 2018-05-07 ] | ||||||||
|
Seems it's a bit more complicated. According to https://mariadb.com/kb/en/library/week/, this is configurable via system variable default-week-format. We don't currently bring system variables down to functions. We may want to consider doing that. | ||||||||
| Comment by Andrew Hutchings (Inactive) [ 2018-05-08 ] | ||||||||
|
There are two separate problems here: 1. We need to document what is in my first comment (this bug) | ||||||||
| Comment by Andrew Hutchings (Inactive) [ 2018-06-15 ] | ||||||||
|
Actually this isn't a documentation bug. For WEEK() the plugin takes the MariaDB system variable and makes this a parameter. It doesn't do this for EXTRACT() with WEEK. | ||||||||
| Comment by Todd Stoffel (Inactive) [ 2022-11-05 ] | ||||||||
|
Item is out of date. Closing due to inactivity. If you feel this was done in error please open a new ticket. |