alamb commented on code in PR #3213:
URL: https://github.com/apache/arrow-datafusion/pull/3213#discussion_r950824271


##########
datafusion/expr/src/operator.rs:
##########
@@ -79,6 +79,41 @@ pub enum Operator {
     StringConcat,
 }
 
+impl Operator {
+    /// If the operator can be negated, return the negated operator
+    /// otherwise return None
+    pub fn negate(&self) -> Option<Operator> {
+        match self {
+            Operator::Eq => Some(Operator::NotEq),
+            Operator::NotEq => Some(Operator::Eq),
+            Operator::Lt => Some(Operator::GtEq),
+            Operator::LtEq => Some(Operator::Gt),
+            Operator::Gt => Some(Operator::LtEq),
+            Operator::GtEq => Some(Operator::Lt),
+            Operator::Like => Some(Operator::NotLike),
+            Operator::NotLike => Some(Operator::Like),
+            Operator::IsDistinctFrom => Some(Operator::IsNotDistinctFrom),
+            Operator::IsNotDistinctFrom => Some(Operator::IsDistinctFrom),
+            Operator::Plus

Review Comment:
   ❤️ 



-- 
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]

Reply via email to