Repository navigation
Commit 51960db
authored
feat: Add expr_adapter_factory getter and with_expr_adapter_factory setter on ListingTable (apache#27317)
## Which issue does this PR close?
Closes apache#27314.
## Rationale for this change
In `ListingTable`, swapping or wrapping the `PhysicalExprAdapterFactory`
of an existing table currently requires manually unpacking individual
fields to construct a `ListingTableConfig` and calling
`ListingTable::try_new(config)`. This is verbose, discards runtime table
state (such as file statistics cache, table definitions, constraints,
and column defaults), and redundantly re-evaluates schemas and
fingerprints.
While `ListingTableConfig` provides `with_expr_adapter_factory`,
`ListingTable` was missing the matching getter and setter after
`SchemaAdapterFactory` was replaced by `PhysicalExprAdapterFactory`.
## What changes are included in this PR?
1. Added `pub fn expr_adapter_factory(&self) -> Option<&Arc<dyn
PhysicalExprAdapterFactory>>` to `ListingTable`.
2. Added `pub fn with_expr_adapter_factory(mut self,
expr_adapter_factory: Arc<dyn PhysicalExprAdapterFactory>) -> Self` to
`ListingTable`.
3. Added unit test in `datafusion/catalog-listing/src/table.rs`
verifying adapter assignment, retrieval, and replacement on cloned
tables without mutating the original table.
## Are these changes tested?
Yes, tested via `test_with_expr_adapter_factory` in
`datafusion-catalog-listing`. Verified clean formatting (`cargo fmt`)
and zero clippy warnings.1 parent ac19b2d commit 51960db
1 file changed
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
345 | 359 | | |
346 | 360 | | |
347 | 361 | | |
| |||
1372 | 1386 | | |
1373 | 1387 | | |
1374 | 1388 | | |
| 1389 | + | |
| 1390 | + | |
1375 | 1391 | | |
| 1392 | + | |
1376 | 1393 | | |
1377 | 1394 | | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
1378 | 1408 | | |
1379 | 1409 | | |
1380 | 1410 | | |
| |||
1662 | 1692 | | |
1663 | 1693 | | |
1664 | 1694 | | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
1665 | 1725 | | |
0 commit comments