Skip to content

Commit

Permalink
Incorrect row comparison for tpch queries in benchmarks (#5784)
Browse files Browse the repository at this point in the history
* Fix incorrect loop range

* fix test

* For review
  • Loading branch information
viirya authored Mar 31, 2023
1 parent 3e1fec1 commit 667f19e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions benchmarks/src/bin/tpch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,18 +1106,31 @@ 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: {}",
l, r, tolerance
)
}
}
(
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)),
}
}
Expand Down

0 comments on commit 667f19e

Please sign in to comment.