Skip to content

Commit a601fbf

Browse files
committed
Add test showing incorrect statistics
1 parent 0235a9e commit a601fbf

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

  • datafusion/core/src/datasource/physical_plan/parquet

datafusion/core/src/datasource/physical_plan/parquet/statistics.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,17 @@ mod test {
550550
(Some(true), Some(3)),
551551
]);
552552
let int_col = i32_array([Some(100), Some(200), Some(300)]);
553-
554553
let expected_min = i32_array([Some(100)]);
555-
556554
let expected_max = i32_array(vec![Some(300)]);
557555

556+
// use a name that shadows a name in the struct column
557+
match struct_col.data_type() {
558+
DataType::Struct(fields) => {
559+
assert_eq!(fields.get(1).unwrap().name(), "int_col")
560+
}
561+
_ => panic!("unexpected data type for struct column"),
562+
};
563+
558564
let input_batch = RecordBatch::try_from_iter([
559565
("struct_col", struct_col),
560566
("int_col", int_col),
@@ -904,19 +910,19 @@ mod test {
904910
Arc::new(array)
905911
}
906912

907-
// returns a struct array with columns "b" and "i" with the specified values
913+
// returns a struct array with columns "bool_col" and "int_col" with the specified values
908914
fn struct_array(input: Vec<(Option<bool>, Option<i32>)>) -> ArrayRef {
909915
let boolean: BooleanArray = input.iter().map(|(b, _i)| b).collect();
910916
let int: Int32Array = input.iter().map(|(_b, i)| i).collect();
911917

912918
let nullable = true;
913919
let struct_array = StructArray::from(vec![
914920
(
915-
Arc::new(Field::new("b", DataType::Boolean, nullable)),
921+
Arc::new(Field::new("bool_col", DataType::Boolean, nullable)),
916922
Arc::new(boolean) as ArrayRef,
917923
),
918924
(
919-
Arc::new(Field::new("i", DataType::Int32, nullable)),
925+
Arc::new(Field::new("int_col", DataType::Int32, nullable)),
920926
Arc::new(int) as ArrayRef,
921927
),
922928
]);

0 commit comments

Comments
 (0)