Skip to content

Parquet: Fix per-column statistics disabling across multiple columns - #17461

Open
Alwaysgaurav1 wants to merge 2 commits into
apache:mainfrom
Alwaysgaurav1:issue-15347-parquet-multi-column-stats
Open

Parquet: Fix per-column statistics disabling across multiple columns#17461
Alwaysgaurav1 wants to merge 2 commits into
apache:mainfrom
Alwaysgaurav1:issue-15347-parquet-multi-column-stats

Conversation

@Alwaysgaurav1

Copy link
Copy Markdown

Closes #15347.

Parquet.setColumnStatsConfig previously applied per-column statistics enablement via withColumnStatsEnabled.accept(...) on ParquetProperties.Builder / ParquetWriter.Builder but did not propagate parquet.column.statistics.enabled#<column> into the Hadoop Configuration instance (conf).

When users configured multiple table properties to disable statistics across multiple columns (e.g., write.parquet.stats-enabled.column.colA = false and write.parquet.stats-enabled.column.colB = false), statistics were only disabled for the first column processed while subsequent columns continued to write statistics into the Parquet file header.

This change explicitly passes per-column statistics enablement settings into conf as well (parquet.column.statistics.enabled#<parquetColumnPath>), ensuring consistent behavior across all configured columns regardless of write path.

Tests Added

  • testMultipleColumnStatisticsDisabled in TestParquet.java: Validates that configuring write.parquet.stats-enabled.column.<col> = false across multiple columns disables statistics for all specified columns in the generated Parquet file.

Closes apache#15347.

setColumnStatsConfig in Parquet.java previously applied per-column statistics enablement via withColumnStatsEnabled.accept(...) but did not set parquet.column.statistics.enabled#<column> in the Hadoop Configuration instance. When configuring multiple columns to false via write.parquet.stats-enabled.column.<column>, only the first column's statistics were disabled.

This change explicitly passes per-column statistics enablement settings into conf as well, ensuring consistent behavior across multiple columns.

Added unit test testMultipleColumnStatisticsDisabled in TestParquet.java.
boolean enabled = Boolean.parseBoolean(isEnabled);
withColumnStatsEnabled.accept(parquetColumnPath, enabled);
conf.set(
"parquet.column.statistics.enabled#" + parquetColumnPath,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The added conf.set("parquet.column.statistics.enabled#" + parquetColumnPath, String.valueOf(enabled)) is dead code. The key parquet.column.statistics.enabled# is consumed only by ParquetOutputFormat.ColumnConfigParser (the Hadoop MapReduce write path); Iceberg never invokes ParquetOutputFormat, so this key is never read back by either the createWriterFunc path (ParquetProperties.Builder, line 487) or the ParquetWriteBuilder path (line 532). The real per-column setting routes through withColumnStatsEnabled.accept(parquetColumnPath, enabled) at line 367 → propsBuilder::withStatisticsEnabled / parquetWriteBuilder::withStatisticsEnabled → ColumnProperty.Builder HashMap, which already handles multiple columns independently. The production change is based on a false root-cause diagnosis and should be reverted entirely.

}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No production fix is needed: the multi-column statistics disable path already works on current main. PR #17365 (open, approved) adds equivalent test coverage without any production change and CI is green, confirming the multi-column path is not broken. This PR's test testMultipleColumnStatisticsDisabled does not guard a real regression; it passes with or without the conf.set because the actual enforcement runs through ParquetProperties.Builder, not conf.

@singhpk234
singhpk234 requested a review from huaxingao August 3, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabling statistics across multiple columns

2 participants