Nagato-Yuzuru commented on code in PR #24276:
URL: https://github.com/apache/datafusion/pull/24276#discussion_r3791637322
##########
datafusion/expr-common/src/sort_properties.rs:
##########
@@ -89,35 +91,410 @@ impl SortProperties {
}),
(_, Self::Singleton) => *self,
(Self::Ordered(lhs), Self::Ordered(rhs))
- if lhs.descending != rhs.descending =>
+ if lhs.descending != rhs.descending
+ && lhs.nulls_first == rhs.nulls_first =>
{
*self
}
_ => Self::Unordered,
}
}
+ pub fn and(&self, rhs: &Self) -> Self {
+ // `descending == nulls_first` selects ASC NULLS LAST / DESC NULLS
FIRST.
+ self.kleene(rhs, |opt| opt.descending == opt.nulls_first)
+ }
+
+ pub fn or(&self, rhs: &Self) -> Self {
+ // `descending != nulls_first` selects ASC NULLS FIRST / DESC NULLS
LAST.
+ self.kleene(rhs, |opt| opt.descending != opt.nulls_first)
+ }
+ #[deprecated(
+ since = "55.0.0",
+ note = "`AND` and `OR` propagate orderings differently under
three-valued logic; use `and` or `or`"
+ )]
pub fn and_or(&self, rhs: &Self) -> Self {
Review Comment:
It's make sense. I've removed `SortProperties::and_or` and update the
document.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]