Skip to content

Make From<ConfigFileDecryptionProperties>/ConfigFileEncryptionProperties conversions fallible (TryFrom) #21974

Description

@kumarUjjawal

Is your feature request related to a problem or challenge?

The conversions from ConfigFileDecryptionProperties to FileDecryptionProperties (and the matching encryption pair) currently use From, but the implementations contain several unwrap() and expect() calls. Bad input, for example a config value with an invalid hex string for the footer key, a column key, or the AAD prefix will panic instead of returning an error.

This was raised by @nuno-faria as a follow-up on #21603 (comment)

Describe the solution you'd like

Replace the two From impls with TryFrom, returning DataFusionError::Configuration (or a similar variant) for:

  • Invalid hex in footer_key_as_hex, column_key_as_hex, aad_prefix_as_hex, footer_key_metadata_as_hex, or column_metadata_as_hex.
  • Errors from FileDecryptionProperties::builder(...).with_column_keys(...) and .build().
  • Errors from FileEncryptionProperties::builder(...).build().

Update in-tree callers to use try_from / try_into

Describe alternatives you've considered

Returning a Result only from a new constructor while keeping From for backward compatibility. Adds API surface without removing the panic risk.

Additional context

Origin: #21603 (comment)

Related follow-ups already filed for the encryption conversion work: #21634, apache/arrow-rs#9721

Activity

  1. changed the title [-]Make From<ConfigFileDecryptionProperties>/ConfigFileEncryptionProperties conversions fallible (TryFrom)[/-] [+]Make `From<ConfigFileDecryptionProperties>/ConfigFileEncryptionProperties` conversions fallible (TryFrom)[/+] on May 1, 2026
  2. kumarUjjawal commented on May 1, 2026

    @kumarUjjawal
    ContributorAuthor

    @adamreeve would you be interested in picking this up?

  3. Soham-Bhattacharjee-work commented on May 1, 2026

    @Soham-Bhattacharjee-work
    Contributor
  4. Soham-Bhattacharjee-work commented on May 2, 2026

    @Soham-Bhattacharjee-work
    Contributor

    PR is up #21985. I would love to do any more changes if required @kumarUjjawal 😄

  5. added a commit that references this issue on May 6, 2026
    cd05b41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions