Repository navigation
Commit 60e3d5c
authored
feat: Add file_schema, cache, and expr_adapter_factory accessors to ListingTable and ListingTableConfig (apache#27363)
## Which issue does this PR close?
Follow-up to apache#27317. Closes apache#27314.
## Rationale for this change
In `ListingTable` and `ListingTableConfig`, several fields lacked
accessors:
1. `ListingTable::file_schema`: Currently `table.schema()` returns the
combined table schema (file schema + Hive partition columns). Callers
had no way to inspect or retrieve the raw physical file schema directly,
requiring manual partition-column filtering workarounds as seen in
apache#27314.
2. `ListingTable::cache`: `with_cache` setter existed, but there was no
getter to inspect or forward the attached `FileStatisticsCache`.
3. `ListingTableConfig::expr_adapter_factory`:
`with_expr_adapter_factory` setter existed, but the field was
`pub(crate)` without a public getter.
## What changes are included in this PR?
1. Added `pub fn file_schema(&self) -> &SchemaRef` to `ListingTable`.
2. Added `pub fn cache(&self) -> Option<&Arc<FileStatisticsCache>>` to
`ListingTable`.
3. Added `pub fn expr_adapter_factory(&self) -> Option<&Arc<dyn
PhysicalExprAdapterFactory>>` to `ListingTableConfig`.
4. Added unit tests for all three accessors in `table.rs` and
`config.rs`.
## Are these changes tested?
Yes, tested via unit tests in `datafusion-catalog-listing`:
- `test_file_schema`
- `test_cache`
- `test_config_expr_adapter_factory`
Verified with `cargo fmt` and `cargo clippy`.1 parent 1a7ceda commit 60e3d5c
2 files changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
272 | 277 | | |
273 | 278 | | |
274 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
305 | 310 | | |
306 | 311 | | |
307 | 312 | | |
| |||
323 | 328 | | |
324 | 329 | | |
325 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
326 | 336 | | |
327 | 337 | | |
328 | 338 | | |
| |||
0 commit comments