Skip to content

fix: Add missing member to visitor for ConfigFileEncryptionProperties #17103

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

Merged
merged 5 commits into from
Aug 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions datafusion/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,43 @@ impl TableParquetOptions {
..self
}
}

/// Retrieves all configuration entries from this `TableParquetOptions`.
///
/// # Returns
///
/// A vector of `ConfigEntry` instances, representing all the configuration options within this
pub fn entries(self: &TableParquetOptions) -> Vec<ConfigEntry> {
struct Visitor(Vec<ConfigEntry>);

impl Visit for Visitor {
fn some<V: Display>(
&mut self,
key: &str,
value: V,
description: &'static str,
) {
self.0.push(ConfigEntry {
key: key[1..].to_string(),
value: Some(value.to_string()),
description,
})
}

fn none(&mut self, key: &str, description: &'static str) {
self.0.push(ConfigEntry {
key: key[1..].to_string(),
value: None,
description,
})
}
}

let mut v = Visitor(vec![]);
self.visit(&mut v, "", "");

v.0
}
}

impl ConfigField for TableParquetOptions {
Expand Down Expand Up @@ -2147,6 +2184,8 @@ impl ConfigField for ConfigFileEncryptionProperties {
let desc = "Metadata to use for the parquet footer";
self.footer_key_metadata_as_hex.visit(v, key.as_str(), desc);

self.column_encryption_properties.visit(v, key_prefix, desc);

let key = format!("{key_prefix}.aad_prefix_as_hex");
let desc = "AAD prefix to use";
self.aad_prefix_as_hex.visit(v, key.as_str(), desc);
Expand Down Expand Up @@ -2626,7 +2665,7 @@ impl Display for OutputFormat {
mod tests {
use crate::config::{
ConfigEntry, ConfigExtension, ConfigField, ConfigFileType, ExtensionOptions,
Extensions, TableOptions,
Extensions, TableOptions, TableParquetOptions,
};
use std::any::Any;
use std::collections::HashMap;
Expand Down Expand Up @@ -2884,7 +2923,7 @@ mod tests {
#[cfg(feature = "parquet_encryption")]
#[test]
fn parquet_encryption_factory_config() {
let mut parquet_options = crate::config::TableParquetOptions::default();
let mut parquet_options = TableParquetOptions::default();

assert_eq!(parquet_options.crypto.factory_id, None);
assert_eq!(parquet_options.crypto.factory_options.options.len(), 0);
Expand Down Expand Up @@ -2925,6 +2964,23 @@ mod tests {
.any(|item| item.key == "format.bloom_filter_enabled::col1"))
}

#[cfg(feature = "parquet")]
#[test]
fn parquet_table_parquet_options_config_entry() {
let mut table_parquet_options = TableParquetOptions::new();
table_parquet_options
.set(
"crypto.file_encryption.column_key_as_hex::double_field",
"31323334353637383930313233343530",
)
.unwrap();
let entries = table_parquet_options.entries();
assert!(entries
.iter()
.any(|item| item.key
== "crypto.file_encryption.column_key_as_hex::double_field"))
}

#[cfg(feature = "parquet")]
#[test]
fn parquet_table_options_config_metadata_entry() {
Expand Down