Refactor Parquet DecryptionPropertiesBuilder #7477
Merged
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?
Closes #7476
Rationale for this change
Tidies up code to make it more maintainable and also makes invalid uses of the builder (ie. setting column keys directly when using a key retriever) cause a compilation error rather than a runtime error.
#7286 (comment) suggested changing
DecryptionPropertiesBuilder
to be an enum, but that would require changingDecryptionPropertiesBuilder::with_column_key
to return aResult
, and I figured it would be better to keep the API mostly source compatible and make it a compilation error to call this when a key retriever is used rather than a runtime error.What changes are included in this PR?
Refactors how
FileDecryptionProperties
are built when using a key retriever by adding a newDecryptionPropertiesBuilderWithRetriever
type.Are there any user-facing changes?
Yes, this is a breaking change to the Parquet encryption API, but should be source compatible unless users were directly calling
DecryptionPropertiesBuilder::new_with_key_retriever
rather thanFileDecryptionProperties::with_key_retriever
(all tests used the latter method so didn't need to be changed). Parquet encryption is also a recently added experimental feature so I don't imagine this will affect many users.