You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ak...@apache.org on 2024/01/22 07:20:11 UTC
(arrow-datafusion) branch main updated: Fix expr partial ord test (#8908)
This is an automated email from the ASF dual-hosted git repository.
akurmustafa pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new c0a69a7124 Fix expr partial ord test (#8908)
c0a69a7124 is described below
commit c0a69a7124b27a74bc26f5b9afb8c6ac8980b240
Author: Mustafa Akur <10...@users.noreply.github.com>
AuthorDate: Mon Jan 22 10:20:05 2024 +0300
Fix expr partial ord test (#8908)
* Fix expr partial ord test
* Add comment
* Resolve linter error
---
datafusion/expr/src/expr.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs
index 40d40692e5..9aeebb190e 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]