Skip to content

Refactor encryptor and decryptor interfaces to enable parallel decrypt in external DBPA#246

Merged
sofia-tekdatum merged 7 commits intomainfrom
change_interfaces
Feb 26, 2026
Merged

Refactor encryptor and decryptor interfaces to enable parallel decrypt in external DBPA#246
sofia-tekdatum merged 7 commits intomainfrom
change_interfaces

Conversation

@sofia-tekdatum
Copy link
Collaborator

@sofia-tekdatum sofia-tekdatum commented Feb 12, 2026

Refactor encryptor and decryptor interfaces to enable parallel processing in decrypt.

Removing UpdateEncodingProperties as a method and adding it in the helpers.

Removing the restriction on using ExternalDBPA and the multi thread flag.

Updated tests.

All tests pass locally and base and canonical app run successfully.

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

Copy link
Collaborator

@argmarco-tkd argmarco-tkd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Thanks for this!

Left a couple of comments - not blockers (but one of them may spark a separate discussion on performace)

::arrow::util::span<const uint8_t> aad,
::arrow::util::span<uint8_t> ciphertext) {
::arrow::util::span<uint8_t> ciphertext,
std::unique_ptr<EncodingProperties> encoding_properties) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but thinking performance - is passing a ptr to EncodingProperties, or passing by value more efficient (can be left for a later pass - but decided to ask given that we're changing the interface)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep it this way to explicitly transfer ownership of the pointer. The move here is calling the pointer only, not the deep copy of the EncodingProperties within.

// Some Encryptors and Decryptors may need to understand the page encoding before the
// encryption process. This method will be called from the Encrypt and Decrypt
// WithManagedBuffer methods.
std::unique_ptr<EncodingProperties> UpdateEncodingProperties(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:"BuildEncodingProperties" or similar may be a a better name for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@sofia-tekdatum sofia-tekdatum changed the title First attempt at refactoring classes Refactor encryptor and decryptor interfaces to enable parallel decrypt in external DBPA Feb 25, 2026
Copy link
Collaborator Author

@sofia-tekdatum sofia-tekdatum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterated over the PR, PTAL.

// Some Encryptors and Decryptors may need to understand the page encoding before the
// encryption process. This method will be called from the Encrypt and Decrypt
// WithManagedBuffer methods.
std::unique_ptr<EncodingProperties> UpdateEncodingProperties(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

::arrow::util::span<const uint8_t> aad,
::arrow::util::span<uint8_t> ciphertext) {
::arrow::util::span<uint8_t> ciphertext,
std::unique_ptr<EncodingProperties> encoding_properties) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep it this way to explicitly transfer ownership of the pointer. The move here is calling the pointer only, not the deep copy of the EncodingProperties within.

Copy link
Collaborator

@argmarco-tkd argmarco-tkd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, thanks!. left a question on a change in file_deserialize_test.cc

compression_codec_(compression_codec) {}

[[nodiscard]] bool CanCalculateLengths() const override { return true; }
[[nodiscard]] bool CanCalculateLengths() const override { return false; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we need to make this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because otherwise the regular Decrypt would be called, and that one has no EncodingProperties sent, so they would be null and the test would fail.

int32_t InvokeExternalEncrypt(::arrow::util::span<const uint8_t> plaintext,
::arrow::ResizableBuffer* ciphertext,
std::map<std::string, std::string> encoding_attrs);
std::unique_ptr<EncodingProperties> encoding_properties);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.

@sofia-tekdatum sofia-tekdatum merged commit 208a9f0 into main Feb 26, 2026
43 of 103 checks passed
@sofia-tekdatum sofia-tekdatum deleted the change_interfaces branch February 26, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Arrow Encryptor/Decryptor interface to receive page-level attributes

2 participants