alamb commented on code in PR #8489:
URL: https://github.com/apache/arrow-datafusion/pull/8489#discussion_r1428793524
##########
datafusion/physical-plan/src/common.rs:
##########
@@ -685,20 +694,30 @@ mod tests {
let schema = Arc::new(Schema::new(vec![
Field::new("f32", DataType::Float32, false),
Field::new("f64", DataType::Float64, false),
+ Field::new("u64", DataType::UInt64, false),
]));
let batch = RecordBatch::try_new(
Arc::clone(&schema),
vec![
Arc::new(Float32Array::from(vec![1., 2., 3.])),
Arc::new(Float64Array::from(vec![9., 8., 7.])),
+ Arc::new(UInt64Array::from(vec![4, 5, 6])),
],
)?;
+
+ // just select f32,f64
+ let select_projection = Some(vec![0, 1]);
+ let byte_size = batch
+ .project(&select_projection.clone().unwrap())
+ .unwrap()
+ .get_array_memory_size();
+
let actual =
- compute_record_batch_statistics(&[vec![batch]], &schema,
Some(vec![0, 1]));
+ compute_record_batch_statistics(&[vec![batch]], &schema,
select_projection);
- let mut expected = Statistics {
+ let expected = Statistics {
num_rows: Precision::Exact(3),
- total_byte_size: Precision::Exact(464), // this might change a bit
if the way we compute the size changes
+ total_byte_size: Precision::Exact(byte_size),
Review Comment:
I think it happens to be the (current) size of the record batch in the test:
```rust
let batch = RecordBatch::try_new(
Arc::clone(&schema),
vec![
Arc::new(Float32Array::from(vec![1., 2., 3.])),
Arc::new(Float64Array::from(vec![9., 8., 7.])),
Arc::new(UInt64Array::from(vec![4, 5, 6])),
],
)?;
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]