etseidl commented on code in PR #8817:
URL: https://github.com/apache/arrow-rs/pull/8817#discussion_r2511403799
##########
parquet/src/file/metadata/writer.rs:
##########
@@ -227,22 +231,38 @@ impl<'a, W: Write> ThriftMetadataWriter<'a, W> {
None => builder.set_row_groups(row_groups),
};
- let column_indexes: Option<ParquetColumnIndex> =
column_indexes.map(|ovvi| {
- ovvi.into_iter()
- .map(|vi| {
- vi.into_iter()
- .map(|oi| oi.unwrap_or(ColumnIndexMetaData::NONE))
- .collect()
- })
- .collect()
- });
-
- // FIXME(ets): this will panic if there's a missing index.
- let offset_indexes: Option<ParquetOffsetIndex> =
offset_indexes.map(|ovvi| {
- ovvi.into_iter()
- .map(|vi| vi.into_iter().map(|oi| oi.unwrap()).collect())
- .collect()
- });
+ // test to see if all indexes for this file are empty
+ let all_none = column_indexes
+ .as_ref()
+ .is_some_and(|ci| ci.iter().all(|cii| cii.iter().all(|idx|
idx.is_none())));
Review Comment:
I found this problem while writing the test for the original issue #8815
##########
parquet/src/file/metadata/writer.rs:
##########
@@ -113,6 +113,10 @@ impl<'a, W: Write> ThriftMetadataWriter<'a, W> {
for (row_group_idx, row_group) in
self.row_groups.iter_mut().enumerate() {
for (column_idx, column_metadata) in
row_group.columns.iter_mut().enumerate() {
if let Some(column_index) =
&column_indexes[row_group_idx][column_idx] {
+ // Missing indexes may also have the placeholder
ColumnIndexMetaData::NONE
+ if matches!(column_index, ColumnIndexMetaData::NONE) {
+ continue;
+ }
Review Comment:
This is the fix for the problem detected in #8811
--
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]