feat: Making From<ConfigFileDecryptionProperties/ConfigFileEncryptionProperties> conversions fallible with TryFrom#21985
Open
Soham-Bhattacharjee-work wants to merge 3 commits intoapache:mainfrom
Conversation
TryFromTryFrom
kumarUjjawal
reviewed
May 2, 2026
Contributor
kumarUjjawal
left a comment
There was a problem hiding this comment.
Thank you @Soham-Bhattacharjee-work I have left some comments, also can you update the pr body that this is user facing change since it is API breaking
| let encryption_key = hex::decode(&encryption_props.column_key_as_hex) | ||
| .expect("Invalid column encryption key"); | ||
| .map_err(|e| { | ||
| DataFusionError::Configuration(format!("Unable to decode hex encryption key metadata for column {column_name}: {e}")) |
Contributor
There was a problem hiding this comment.
message says "encryption key metadata", but this is decoding the actual column encryption key. Please change it.
| #[cfg(feature = "parquet_encryption")] | ||
| impl From<ConfigFileEncryptionProperties> for FileEncryptionProperties { | ||
| fn from(val: ConfigFileEncryptionProperties) -> Self { | ||
| impl TryFrom<ConfigFileEncryptionProperties> for FileEncryptionProperties { |
Contributor
There was a problem hiding this comment.
we need entry in upgrade guide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
From<ConfigFileDecryptionProperties>/ConfigFileEncryptionPropertiesconversions fallible (TryFrom) #21974 .Rationale for this change
The conversions from
ConfigFileDecryptionPropertiestoFileDecryptionPropertiesand fromConfigFileEncryptionPropertiestoFileEncryptionPropertiescurrently use From, but the implementations contain several unwrap() and expect() calls which can cause panics for invalid or wrong inputs. Instead of panics we can gracefully returnDataFusionError::Confogurationerrors.What changes are included in this PR?
becomes
Similarly
becomes
These are header changes with accompanied implementation changes
Are these changes tested?
Yes tests are added in
datafusion/common/src/config.rsAre there any user-facing changes?
No according to me, they are not. They are part of
datafusion-common.