-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: Making From<ConfigFileDecryptionProperties/ConfigFileEncryptionProperties> conversions fallible with TryFrom
#21985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
94d658b
854d6b8
84da70f
552abe7
acc50e6
2ae481e
9d21471
f84b281
c7f4b0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,6 +447,48 @@ let config_decryption_properties = ConfigFileDecryptionProperties::try_from(&dec | |
| See [#21602](https://github.com/apache/datafusion/issues/21602) and | ||
| [PR #21603](https://github.com/apache/datafusion/pull/21603) for details. | ||
|
|
||
| ### Conversion from `ConfigFileEncryptionProperties` / `ConfigFileDecryptionProperties` is now fallible | ||
|
|
||
| Previously, `datafusion_common::config::ConfigFileEncryptionProperties` and | ||
| `datafusion_common::config::ConfigFileDecryptionProperties` implemented infallible | ||
| conversions into Parquet's encryption/decryption types (via `From` / `Into`). | ||
| These conversions may need to decode hex-encoded keys and other configuration values, which can fail. | ||
|
|
||
| They now use `TryFrom` / `TryInto` and return a `Result`: | ||
|
|
||
| - `impl TryFrom<ConfigFileEncryptionProperties> for parquet::encryption::encrypt::FileEncryptionProperties` | ||
| - `impl TryFrom<ConfigFileDecryptionProperties> for parquet::encryption::decrypt::FileDecryptionProperties` | ||
|
|
||
| **Migration guide:** | ||
|
|
||
| Replace `from()` / `into()` with `try_from()` / `try_into()` and handle the resulting `Result`. | ||
|
|
||
| **Before:** | ||
|
|
||
| ```rust,ignore | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This upgrade guide section feels too long for the actual API change. The migration is just replacing from/into with try_from/try_into and handling the Result. Could we shorten this to a small before/after snippet instead of showing the full encryption and decryption config setup? Take inspiration from the work just above for the similar change.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| let file_encryption_properties: FileEncryptionProperties = config_encryption_properties.into(); | ||
| // or | ||
| let file_decryption_properties = FileDecryptionProperties::from(config_decryption_properties); | ||
| ``` | ||
|
|
||
| ( | ||
| where `config_encryption_properties` is a `ConfigFileEncryptionProperties` and | ||
| `config_decryption_properties` is a `ConfigFileDecryptionProperties` | ||
| ) | ||
|
|
||
| **After:** | ||
|
|
||
| ```rust,ignore | ||
| let file_encryption_properties: FileEncryptionProperties = | ||
| config_encryption_properties.try_into()?; | ||
| // or | ||
| let file_decryption_properties = | ||
| FileDecryptionProperties::try_from(config_decryption_properties)?; | ||
| ``` | ||
|
|
||
| See [#21974](https://github.com/apache/datafusion/issues/21974) and | ||
| [PR #21985](https://github.com/apache/datafusion/pull/21985) for details. | ||
|
|
||
| ### `approx_percentile_cont`, `approx_percentile_cont_with_weight`, `approx_median` now coerce to floats | ||
|
|
||
| The type signatures of `approx_percentile_cont`, `approx_percentile_cont_with_weight`, and | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need entry in upgrade guide.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @kumarUjjawal