-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement non-nested struct statistic extraction #10730
Conversation
@@ -1155,7 +1155,6 @@ async fn test_boolean() { | |||
// BUG | |||
// https://github.com/apache/datafusion/issues/10609 | |||
// Note that: since I have not worked on struct array before, there may be a bug in the test code rather than the real bug in the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we can update the comments here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Lordworms
} | ||
match field.data_type() { | ||
DataType::Struct(_) => { | ||
let parquet_idx = (0..parquet_schema.columns().len()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tustvold could you help here -- is this the correct way to find the correct parquet leaf from an arrow struct type?
@@ -1168,7 +1165,7 @@ async fn test_struct() { | |||
reader: reader.build().await, | |||
expected_min: Arc::new(struct_array(vec![(Some(1), Some(6.0), Some(12.0))])), | |||
expected_max: Arc::new(struct_array(vec![(Some(2), Some(8.5), Some(14.0))])), | |||
expected_null_counts: UInt64Array::from(vec![0]), | |||
expected_null_counts: UInt64Array::from(vec![2]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something isn't right here -- the structs themselves aren't nullable (only some of their child fields)
datafusion/datafusion/core/tests/parquet/mod.rs
Lines 954 to 958 in 7c08a6f
let struct_array_data = struct_array(vec![ | |
(Some(1), Some(6.0), Some(12.0)), | |
(Some(2), Some(8.5), None), | |
(None, Some(8.5), Some(14.0)), | |
]); |
datafusion/datafusion/core/tests/parquet/mod.rs
Lines 1024 to 1045 in 7c08a6f
fn struct_array(input: Vec<(Option<i32>, Option<f32>, Option<f64>)>) -> ArrayRef { | |
let int_32: Int32Array = input.iter().map(|(i, _, _)| i).collect(); | |
let float_32: Float32Array = input.iter().map(|(_, f, _)| f).collect(); | |
let float_64: Float64Array = input.iter().map(|(_, _, f)| f).collect(); | |
let nullable = true; | |
let struct_array = StructArray::from(vec![ | |
( | |
Arc::new(Field::new("int32_col", DataType::Int32, nullable)), | |
Arc::new(int_32) as ArrayRef, | |
), | |
( | |
Arc::new(Field::new("float32_col", DataType::Float32, nullable)), | |
Arc::new(float_32) as ArrayRef, | |
), | |
( | |
Arc::new(Field::new("float64_col", DataType::Float64, nullable)), | |
Arc::new(float_64) as ArrayRef, | |
), | |
]); | |
Arc::new(struct_array) | |
} |
return Ok(Arc::new(new_empty_array(&DataType::UInt64)) as ArrayRef); | ||
} | ||
|
||
let mut null_count: u64 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nulls only have to check the current nulls (not their children's nulls)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I'll fix it
Which issue does this PR close?
Closes #10609
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?