isidentical commented on code in PR #3868:
URL: https://github.com/apache/arrow-datafusion/pull/3868#discussion_r1000049117
##########
datafusion/expr/src/operator.rs:
##########
@@ -115,6 +115,41 @@ impl Operator {
| Operator::StringConcat => None,
}
}
+
+ /// Return the operator where swapping lhs and rhs wouldn't change the
result.
+ ///
+ /// For example `Binary(50, >=, a)` could also be represented as
`Binary(a, <=, 50)`.
+ pub fn swap(&self) -> Option<Operator> {
+ match self {
+ Operator::Lt => Some(Operator::Gt),
+ Operator::LtEq => Some(Operator::GtEq),
+ Operator::Gt => Some(Operator::Lt),
+ Operator::GtEq => Some(Operator::LtEq),
+ Operator::Eq
Review Comment:
That's true, thanks for the catch!
--
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]