Apache DataFusion SQL Query Engine
Incorrect row comparison for tpch queries in benchmarks (#5784)
Liang-Chi Hsieh667f19ebad21
diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rsindex 86d2215dc2..1c50478522 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)),}}