-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rename boolean Interval constants to match NullableInterval
#18654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CERTAINLY_FALSE -> FALSE CERTAINLY_TRUE -> TRUE UNCERTAIN -> TRUE_OR_FALSE
| } | ||
|
|
||
| // Tests that there's no such thing as a 'null' boolean interval. | ||
| // An interval with two `Boolean(None)` boundaries is normalised to `Interval::UNCERTAIN`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // An interval with two `Boolean(None)` boundaries is normalised to `Interval::TRUE_OR_FALSE`. |
|
Thanks @martin-g. I hadn't realised the rename refactoring did not update the comments as well. |
|
I noticed one and then let ripgrep catch them all 😄 |
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pepijnve - I think this is a really nice improvement to the code
|
|
||
| if self.op.eq(&Operator::And) { | ||
| if interval.eq(&Interval::CERTAINLY_TRUE) { | ||
| if interval.eq(&Interval::TRUE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes really make the code easier to read and understand -- thank you @pepijnve
| /// This interval is semantically equivalent to [Interval::FALSE]. | ||
| pub const FALSE: Self = NullableInterval::NotNull { | ||
| values: Interval::CERTAINLY_FALSE, | ||
| values: Interval::FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now has a very nice symmetry to it
# Conflicts: # datafusion/expr-common/src/interval_arithmetic.rs
|
Merge conflicts resolved. All other comments have been addressed. |
|
I will merge this once CI passes |
|
Thank you @pepijnve |
…he#18654) ## Which issue does this PR close? - None, followup to apache#18625 ## Rationale for this change The discussion in apache#18625 made it clear that the naming of the truth value intervals would benefit from consistency. After some back and forth we concluded that consistency with the SQL specification seemed like the best idea. This PR renames the boolean `Interval` and `NullableInterval` constants to all be consistent. ## What changes are included in this PR? Mechanical refactoring where the following renames were performed: - `Interval::CERTAINLY_TRUE` -> `Interval::TRUE` - `Interval::CERTAINLY_FALSE` -> `Interval::FALSE` - `Interval::UNCERTAIN` -> `Interval::TRUE_OR_FALSE` - `NullableInterval::UNCERTAIN` -> `NullableInterval::ANY_TRUTH_VALUE` The old constant names have been retained with a deprecation note. ## Are these changes tested? No new code ## Are there any user-facing changes? Yes, the old constants are now marked deprecated
Which issue does this PR close?
NullableInterval::andandNullableInterval::or. #18625Rationale for this change
The discussion in #18625 made it clear that the naming of the truth value intervals would benefit from consistency. After some back and forth we concluded that consistency with the SQL specification seemed like the best idea.
This PR renames the boolean
IntervalandNullableIntervalconstants to all be consistent.What changes are included in this PR?
Mechanical refactoring where the following renames were performed:
Interval::CERTAINLY_TRUE->Interval::TRUEInterval::CERTAINLY_FALSE->Interval::FALSEInterval::UNCERTAIN->Interval::TRUE_OR_FALSENullableInterval::UNCERTAIN->NullableInterval::ANY_TRUTH_VALUEThe old constant names have been retained with a deprecation note.
Are these changes tested?
No new code
Are there any user-facing changes?
Yes, the old constants are now marked deprecated