Skip to content
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

deprecate max_statistics_size #14175

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions datafusion/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,23 @@ use crate::{DataFusionError, Result};
macro_rules! config_namespace {
(
$(#[doc = $struct_d:tt])*
$(#[allow($($struct_depr:tt)*)])?
$vis:vis struct $struct_name:ident {
$(
$(#[doc = $d:tt])*
$(#[allow($($field_depr:tt)*)])?
$field_vis:vis $field_name:ident : $field_type:ty, $(warn = $warn: expr,)? $(transform = $transform:expr,)? default = $default:expr
)*$(,)*
}
) => {

$(#[doc = $struct_d])*
$(#[allow($($struct_depr)*)])?
#[derive(Debug, Clone, PartialEq)]
$vis struct $struct_name{
$(
$(#[doc = $d])*
$(#[allow($($field_depr)*)])?
$field_vis $field_name : $field_type,
)*
}
Expand Down Expand Up @@ -378,6 +382,7 @@ config_namespace! {
/// See also: [`SessionConfig`]
///
/// [`SessionConfig`]: https://docs.rs/datafusion/latest/datafusion/prelude/struct.SessionConfig.html
// #[derive(Debug)]
pub struct ParquetOptions {
// The following options affect reading parquet files

Expand Down Expand Up @@ -467,6 +472,7 @@ config_namespace! {

/// (writing) Sets max statistics size for any column. If NULL, uses
/// default parquet writer setting
#[allow(deprecated)]
logan-keede marked this conversation as resolved.
Show resolved Hide resolved
pub max_statistics_size: Option<usize>, default = Some(4096)

/// (writing) Target maximum number of rows in each row group (defaults to 1M
Expand Down Expand Up @@ -1598,19 +1604,23 @@ impl ConfigField for TableParquetOptions {
macro_rules! config_namespace_with_hashmap {
(
$(#[doc = $struct_d:tt])*
$(#[allow($($struct_depr:tt)*)])?
$vis:vis struct $struct_name:ident {
$(
$(#[doc = $d:tt])*
$(#[allow($($field_depr:tt)*)])?
$field_vis:vis $field_name:ident : $field_type:ty, $(transform = $transform:expr,)? default = $default:expr
)*$(,)*
}
) => {

$(#[doc = $struct_d])*
$(#[allow($($struct_depr)*)])?
#[derive(Debug, Clone, PartialEq)]
$vis struct $struct_name{
$(
$(#[doc = $d])*
$(#[allow($($field_depr)*)])?
$field_vis $field_name : $field_type,
)*
}
Expand Down Expand Up @@ -1669,6 +1679,7 @@ macro_rules! config_namespace_with_hashmap {
$(
let key = format!("{}.{field}::{}", key_prefix, column_name, field = stringify!($field_name));
let desc = concat!($($d),*).trim();
#[allow(deprecated)]
col_options.$field_name.visit(v, key.as_str(), desc);
)*
}
Expand Down Expand Up @@ -1720,6 +1731,7 @@ config_namespace_with_hashmap! {

/// Sets max statistics size for the column path. If NULL, uses
/// default parquet options
#[allow(deprecated)]
pub max_statistics_size: Option<usize>, default = None
}
}
Expand Down
10 changes: 8 additions & 2 deletions datafusion/common/src/file_options/parquet_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,13 @@ impl TryFrom<&TableParquetOptions> for WriterPropertiesBuilder {
builder.set_column_bloom_filter_ndv(path.clone(), bloom_filter_ndv);
}

//max_statistics_size is deprecated as per latest arrow version.
#[allow(deprecated)]
if let Some(max_statistics_size) = options.max_statistics_size {
builder =
builder.set_column_max_statistics_size(path, max_statistics_size);
builder = {
#[allow(deprecated)]
builder.set_column_max_statistics_size(path, max_statistics_size)
}
}
}

Expand Down Expand Up @@ -207,6 +211,8 @@ impl ParquetOptions {
dictionary_enabled,
dictionary_page_size_limit,
statistics_enabled,

#[allow(deprecated)]
max_statistics_size,
max_row_group_size,
created_by,
Expand Down
Loading