alamb commented on a change in pull request #8654:
URL: https://github.com/apache/arrow/pull/8654#discussion_r523752313
##########
File path: rust/datafusion/src/physical_plan/hash_aggregate.rs
##########
@@ -882,25 +867,12 @@ mod tests {
assert_eq!(batch.num_columns(), 2);
assert_eq!(batch.num_rows(), 3);
- let a = batch
- .column(0)
- .as_any()
- .downcast_ref::<UInt32Array>()
- .unwrap();
- let b = batch
- .column(1)
- .as_any()
- .downcast_ref::<Float64Array>()
- .unwrap();
-
- assert_eq!(*a, UInt32Array::from(vec![2, 3, 4]));
+ let mut rows = crate::test::format_batch(&batch);
+ rows.sort();
+
assert_eq!(
- *b,
- Float64Array::from(vec![
- 1.0,
- (2.0 + 3.0 + 2.0) / 3.0,
- (3.0 + 4.0 + 4.0) / 3.0
- ])
+ rows,
Review comment:
The tests changed to be string comparisons so I am not sure we can keep
the arithmetic anymore.
Maybe we could put it in comments, something like
```
vec![
"2,1.0",
"3,2.3333333333333335", // 3, (2 + 3 + 2) / 3
"4,3.6666666666666665" // 4, (3 + 4 + 4) / 3
]
```
##########
File path: rust/datafusion/src/physical_plan/hash_aggregate.rs
##########
@@ -882,25 +867,12 @@ mod tests {
assert_eq!(batch.num_columns(), 2);
assert_eq!(batch.num_rows(), 3);
- let a = batch
- .column(0)
- .as_any()
- .downcast_ref::<UInt32Array>()
- .unwrap();
- let b = batch
- .column(1)
- .as_any()
- .downcast_ref::<Float64Array>()
- .unwrap();
-
- assert_eq!(*a, UInt32Array::from(vec![2, 3, 4]));
+ let mut rows = crate::test::format_batch(&batch);
+ rows.sort();
+
assert_eq!(
- *b,
- Float64Array::from(vec![
- 1.0,
- (2.0 + 3.0 + 2.0) / 3.0,
- (3.0 + 4.0 + 4.0) / 3.0
- ])
+ rows,
Review comment:
The tests changed to be string comparisons so I am not sure we can keep
the arithmetic anymore.
Maybe we could put it in comments, something like
```
vec![
"2,1.0",
"3,2.3333333333333335", // 3, (2 + 3 + 2) / 3
"4,3.6666666666666665" // 4, (3 + 4 + 4) / 3
]
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]