Skip to content
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
47 changes: 0 additions & 47 deletions docs/source/library-user-guide/upgrading/55.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<FieldRef>>`.

**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<SchemaRef>`
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<FieldRef>`. `Fields` dereferences to `&[FieldRef]`, so iteration,
indexing, `len()` and `is_empty()` are unchanged; only code that named the
concrete `&Vec<FieldRef>` type needs to adapt:

```rust
// Before: returned &Vec<FieldRef>
let cols: Vec<FieldRef> = config.table_partition_cols().clone();

// After: returns &Fields; use `to_vec()` for an owned `Vec`
let cols: Vec<FieldRef> = config.table_partition_cols().to_vec();
```
Loading