This is an automated email from the ASF dual-hosted git repository.

viirya 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 667f19eba Incorrect row comparison for tpch queries in benchmarks 
(#5784)
667f19eba is described below

commit 667f19ebad216b7592af5a91b70a24fb21c3bb64
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Fri Mar 31 00:11:47 2023 -0700

    Incorrect row comparison for tpch queries in benchmarks (#5784)
    
    * Fix incorrect loop range
    
    * fix test
    
    * For review
---
 benchmarks/src/bin/tpch.rs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rs
index 86d2215dc..1c5047852 100644
--- a/benchmarks/src/bin/tpch.rs
+++ b/benchmarks/src/bin/tpch.rs
@@ -1106,11 +1106,11 @@ mod ci {
             let actual_row = &actual_vec[i];
             assert_eq!(expected_row.len(), actual_row.len());
 
-            for j in 0..expected.len() {
+            let tolerance = 0.1;
+            for j in 0..expected_row.len() {
                 match (&expected_row[j], &actual_row[j]) {
                     (ScalarValue::Float64(Some(l)), 
ScalarValue::Float64(Some(r))) => {
                         // allow for rounding errors until we move to decimal 
types
-                        let tolerance = 0.1;
                         if (l - r).abs() > tolerance {
                             panic!(
                                 "Expected: {}; Actual: {}; Tolerance: {}",
@@ -1118,6 +1118,19 @@ mod ci {
                             )
                         }
                     }
+                    (
+                        ScalarValue::Decimal128(Some(l), _, s),
+                        ScalarValue::Decimal128(Some(r), _, _),
+                    ) => {
+                        if ((l - r) as f64 / 10_i32.pow(*s as u32) as 
f64).abs()
+                            > tolerance
+                        {
+                            panic!(
+                                "Expected: {}; Actual: {}; Tolerance: {}",
+                                l, r, tolerance
+                            )
+                        }
+                    }
                     (l, r) => assert_eq!(format!("{:?}", l), format!("{:?}", 
r)),
                 }
             }

Reply via email to