Add native subclasses for InputFile and OutputFile to simplify.#10
Merged
ggershinsky merged 1 commit intoJan 4, 2024
Merged
Conversation
rdblue
commented
Jan 3, 2024
| import java.nio.ByteBuffer; | ||
|
|
||
| /** {@link EncryptionKeyMetadata} for use with format-native encryption. */ | ||
| public interface NativeEncryptionKeyMetadata extends EncryptionKeyMetadata { |
Author
There was a problem hiding this comment.
This was needed to avoid making StandardKeyMetadata public.
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.
This is an update to apache#9359 that simplifies the read path and addresses review items.
This introduces
NativeEncryptionInputFileto solve problems in the read path. Specifically the encryption manager needed to know whether to decrypt or return the underlying input file, but that depends on the file format and whether that format is capable of native encryption. In addition, the read path also needed to know whether to configure native encryption, which was a separate choice. And I think having a separate encryption choice would also have broken existing encryption managers that handle Parquet files with encrypting streams.Instead, this uses a new
InputFiletype to signal that native encryption should be used if possible and to carry the encryption key. Then the format helpers (Avro,Parquet, andORC) are responsible for either using the encrypting stream (Avro) or applying native encryption (Parquet and ORC).I considered other approaches here, but this was the cleanest because most others required separate handling for encryption keys and didn't cover all paths -- notably missing the Arrow readers. By using the same
InputFileeverywhere, this requires fewer changes to Spark and Flink readers and should work everywhere that the encryption manager is used.