Conversation
src/Functions/CustomWeekTransforms.h
Outdated
There was a problem hiding this comment.
But function toStartOfWeek is always monotonic and it's better to keep this behaviour.
There was a problem hiding this comment.
This looks wrong, because, it will erroneously return true for ranges, that start at the same week, but last more than year and will return false for ranges, that are in one year, but start at different weeks. I think, it's better to use ToStartOfYearImpl as FactorTransform for toWeek like it is done, e.g. for function toMonth in DateTimeTransforms.h.
There was a problem hiding this comment.
Yeah. I didn't understand the code style. It should be trivial :) Updated
src/Functions/CustomWeekTransforms.h
Outdated
There was a problem hiding this comment.
ToStartOfYearImpl? We need to check, that two dates belong to the same year.
There was a problem hiding this comment.
but toStartOfWeek contains year
┌─toStartOfWeek(now())─┐
│ 2021-05-23 │
└──────────────────────┘
There was a problem hiding this comment.
Yes, but toWeek in range of one year can be treated as monotonic, but toStartOfWeek doesn't allow this.
There was a problem hiding this comment.
Ah, right. I failed to understand it twice somehow ...
|
@Mergifyio update |
|
Command
|
|
No new tests failed. |
Backport #24446 to 21.6: Fix toWeek monotonicity
Backport #24446 to 21.5: Fix toWeek monotonicity
Backport #24446 to 21.4: Fix toWeek monotonicity
Backport #24446 to 21.3: Fix toWeek monotonicity
Backport #24446 to 20.8: Fix toWeek monotonicity
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix incorrect monotonicity of toWeek function. This fixes #24422 . This bug was introduced in #5212 , and was exposed later by smarter partition pruner.
Detailed description / Documentation draft:
.