etseidl commented on code in PR #10449:
URL: https://github.com/apache/arrow-rs/pull/10449#discussion_r3729371963
##########
parquet/src/file/metadata/thrift/encryption.rs:
##########
@@ -163,10 +163,21 @@ fn row_group_from_encrypted_thrift(
}
};
+ // The ordinal is part of the AAD for encrypted column metadata.
+ // It can be missing here only for files with *mixed* row-group
+ // ordinals, which decode leaves untouched — fail cleanly rather
+ // than panic (see `ensure_row_group_ordinals`).
+ let rg_ordinal = rg.ordinal.ok_or_else(|| {
+ general_err!(
+ "Row group ordinal is required to decrypt column metadata
for \
+ column '{}', but the file's row-group ordinals are
inconsistent",
+ d.path().string()
+ )
+ })?;
let column_aad = crate::encryption::modules::create_module_aad(
decryptor.file_aad(),
crate::encryption::modules::ModuleType::ColumnMetaData,
- rg.ordinal.unwrap() as usize,
+ rg_ordinal as usize,
Review Comment:
This can be a follow-on PR, but I don't think we ever validate that the
ordinal is positive. Perhaps we should use `usize::try_from` here.
--
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]