diff --git a/docs/source/library-user-guide/upgrading/55.0.0.md b/docs/source/library-user-guide/upgrading/55.0.0.md index acc9d4007faa2..e9a86332cfc49 100644 --- a/docs/source/library-user-guide/upgrading/55.0.0.md +++ b/docs/source/library-user-guide/upgrading/55.0.0.md @@ -70,50 +70,3 @@ such a pruner can never prune anything beyond what planning already did. Previously it returned `Some` whenever a statistics struct was present (the "is this worth pruning?" decision lived in the Parquet opener). Files with column statistics, and predicates that carry a dynamic filter, are unaffected. - -### `TableSchema` gains a builder; `table_partition_cols()` now returns `&Fields` - -`datafusion_datasource::TableSchema` now has a builder, and stores its partition -columns as `arrow::datatypes::Fields` (an immutable `Arc<[FieldRef]>`) instead of -`Arc>`. - -**Construction.** Prefer the new `TableSchemaBuilder`. The file schema is the -only required input; partition columns are optional, and the full table schema -is computed once at `build()`: - -```rust -let table_schema = TableSchema::builder(file_schema) - .with_table_partition_cols(partition_cols) // optional - .build(); -``` - -`TableSchema::new`, `TableSchema::from_file_schema`, and the -`TableSchema::with_table_partition_cols` setter are all **deprecated** in favor -of the builder. For the no-partition-column case, use the `From` -conversion. The setter now _replaces_ rather than appends: - -```rust -// Before -let ts = TableSchema::from_file_schema(file_schema); // no partition columns -let ts = TableSchema::new(file_schema, partition_cols); - -// After -let ts = TableSchema::from(file_schema); // no partition columns (or file_schema.into()) -let ts = TableSchema::builder(file_schema) - .with_table_partition_cols(partition_cols) - .build(); -``` - -**Accessor type.** `TableSchema::table_partition_cols()` and the delegating -`FileScanConfig::table_partition_cols()` now return `&Fields` instead of -`&Vec`. `Fields` dereferences to `&[FieldRef]`, so iteration, -indexing, `len()` and `is_empty()` are unchanged; only code that named the -concrete `&Vec` type needs to adapt: - -```rust -// Before: returned &Vec -let cols: Vec = config.table_partition_cols().clone(); - -// After: returns &Fields; use `to_vec()` for an owned `Vec` -let cols: Vec = config.table_partition_cols().to_vec(); -```