Skip to content

Commit 6672eb6

Browse files
timsaucertobixdev
authored andcommitted
refactor: move ListingTable over to the catalog-listing-table crate (apache#18080)
## Which issue does this PR close? - This addresses part of apache#17713 - Closes apache#14462 ## Rationale for this change In order to remove the `datafusion` core crate from `proto` as a dependency, we need to access `ListingTable` but it is within the `core` crate. There already exists a `datafusion-catalog-listing` which is bare and appears to be the place this should exist. ## What changes are included in this PR? Move `ListingTable` and some of its dependent structs over to the `datafusion-catalog-listing` crate. There is one dependency I wasn't able to remove from the `core` crate, which is inferring the listing table configuration options. That is because within this method it downcasts `Session` to `SessionState`. If a downstream user ever attempts to implement `Session` themselves, these methods also would not work. Because it would cause a circular dependency, we cannot also lift the method we need out of `SessionState` to `Session`. Instead I took the approach of splitting off the two methods that require `SessionState` as an extension trait for the listing table config. From the git diff this appears to be a large change (+1637/-1519) however the *vast* majority of that is copying the code from one file into another. I have added a comment on the significant change. ## Are these changes tested? Existing unit tests show no regression. This is just a code refactor. ## Are there any user-facing changes? Users may need to update their use paths.
1 parent d495bd0 commit 6672eb6

File tree

13 files changed

+1657
-1528
lines changed

13 files changed

+1657
-1528
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-examples/examples/custom_file_casts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use datafusion::common::not_impl_err;
2525
use datafusion::common::tree_node::{Transformed, TransformedResult, TreeNode};
2626
use datafusion::common::{Result, ScalarValue};
2727
use datafusion::datasource::listing::{
28-
ListingTable, ListingTableConfig, ListingTableUrl,
28+
ListingTable, ListingTableConfig, ListingTableConfigExt, ListingTableUrl,
2929
};
3030
use datafusion::execution::context::SessionContext;
3131
use datafusion::execution::object_store::ObjectStoreUrl;

datafusion-examples/examples/json_shredding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use datafusion::common::tree_node::{
2727
};
2828
use datafusion::common::{assert_contains, exec_datafusion_err, Result};
2929
use datafusion::datasource::listing::{
30-
ListingTable, ListingTableConfig, ListingTableUrl,
30+
ListingTable, ListingTableConfig, ListingTableConfigExt, ListingTableUrl,
3131
};
3232
use datafusion::execution::context::SessionContext;
3333
use datafusion::execution::object_store::ObjectStoreUrl;

datafusion/catalog-listing/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,24 @@ datafusion-datasource = { workspace = true }
3939
datafusion-execution = { workspace = true }
4040
datafusion-expr = { workspace = true }
4141
datafusion-physical-expr = { workspace = true }
42+
datafusion-physical-expr-adapter = { workspace = true }
4243
datafusion-physical-expr-common = { workspace = true }
4344
datafusion-physical-plan = { workspace = true }
4445
futures = { workspace = true }
46+
itertools = { workspace = true }
4547
log = { workspace = true }
4648
object_store = { workspace = true }
4749
tokio = { workspace = true }
4850

4951
[dev-dependencies]
52+
datafusion-datasource-parquet = { workspace = true }
5053

5154
[lints]
5255
workspace = true
5356

5457
[lib]
5558
name = "datafusion_catalog_listing"
5659
path = "src/mod.rs"
60+
61+
[package.metadata.cargo-machete]
62+
ignored = ["datafusion-datasource-parquet"]

0 commit comments

Comments
 (0)