You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PartitionedFile statistics grow by one ColumnStatistics per partition column on every protobuf round trip #23998
PartitionedFile statistics do not survive a protobuf round trip when the file has partition values: every encode/decode cycle appends one extra ColumnStatistics entry per partition column.
PartitionedFile::statistics covers the full table schema (file columns followed by partition columns). The encode side writes that vector as-is:
So the partition-column statistics that were already on the wire get appended a second time, and column_statistics.len() grows by partition_values.len() per round trip. Plans that are serialized more than once (a common pattern in distributed engines that re-serialize a plan per stage) keep growing.
To Reproduce
use std::sync::Arc;use arrow::datatypes::{DataType,Field,Schema};use datafusion_common::{ScalarValue,Statistics};use datafusion_datasource::PartitionedFile;use datafusion_proto::TryFromProto;use datafusion_proto::protobuf;let schema = Arc::new(Schema::new(vec![Field::new("a",DataType::Int32,true)]));let pf = PartitionedFile::new("foo/bar.parquet",1234).with_partition_values(vec![ScalarValue::from("2024-01-01")]).with_statistics(Arc::new(Statistics::new_unknown(&schema)));// file column + 1 partition columnassert_eq!(pf.statistics.as_ref().unwrap().column_statistics.len(),2);let proto = protobuf::PartitionedFile::try_from_proto(&pf).unwrap();let decoded = PartitionedFile::try_from_proto(&proto).unwrap();// 3, not 2 — the partition column statistic is appended againassert_eq!(
decoded.statistics.as_ref().unwrap().column_statistics.len(),2);
The decode path should set statistics directly (the wire already carries the full-table-schema statistics) rather than routing through with_statistics, which is a builder helper meant for callers supplying file-only statistics.
Additional context
Found while reviewing #23683, but this is on main today and independent of that PR. Same behavior applies to any other caller that hands with_statistics a statistics vector that already includes the partition columns.
Activity
buraksenn commentedon Jul 30, 2026
take
fix(proto): prevent duplicate partition statistics on roundtrip (apa…
refactor(proto): carry apache#23999 into the moved PartitionedFile de…
refactor(proto): move PartitionedFile / FileGroup serde into datafusi…
fix(proto): prevent duplicate partition statistics on roundtrip (apa…
refactor(proto): move PartitionedFile / FileGroup serde into datafusi…