diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs index 40d40692e593..9aeebb190e81 100644 --- a/datafusion/expr/src/expr.rs +++ b/datafusion/expr/src/expr.rs @@ -1869,10 +1869,14 @@ mod test { let exp2 = col("a") + lit(2); let exp3 = !(col("a") + lit(2)); - assert!(exp1 < exp2); - assert!(exp2 > exp1); - assert!(exp2 > exp3); - assert!(exp3 < exp2); + // Since comparisons are done using hash value of the expression + // expr < expr2 may return false, or true. There is no guaranteed result. + // The only guarantee is "<" operator should have the opposite result of ">=" operator + let greater_or_equal = exp1 >= exp2; + assert_eq!(exp1 < exp2, !greater_or_equal); + + let greater_or_equal = exp3 >= exp2; + assert_eq!(exp3 < exp2, !greater_or_equal); } #[test]