Skip to content

Commit 20fbd88

Browse files
authored
Remove many crate:: imports in listing table provider module (#11887)
This is part of isolating this module in order to be able to move it out of core. This commit attempts to replace all `crate::` imports that are possible to avoid today (i.e. which would be replaced when listing table provider was moved to separate crate), leaving those that cannot be replaced. This makes it easy to notice the remaining coupling between the listing table provider module and the core.
1 parent 56be714 commit 20fbd88

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

datafusion/core/src/datasource/listing/helpers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use std::collections::HashMap;
2121
use std::mem;
2222
use std::sync::Arc;
2323

24+
use super::ListingTableUrl;
2425
use super::PartitionedFile;
25-
use crate::datasource::listing::ListingTableUrl;
2626
use crate::execution::context::SessionState;
27-
use crate::logical_expr::{BinaryExpr, Operator};
28-
use crate::{error::Result, scalar::ScalarValue};
27+
use datafusion_common::{Result, ScalarValue};
28+
use datafusion_expr::{BinaryExpr, Operator};
2929

3030
use arrow::{
3131
array::{Array, ArrayRef, AsArray, StringBuilder},
@@ -518,8 +518,8 @@ mod tests {
518518

519519
use futures::StreamExt;
520520

521-
use crate::logical_expr::{case, col, lit, Expr};
522521
use crate::test::object_store::make_test_store_and_state;
522+
use datafusion_expr::{case, col, lit, Expr};
523523

524524
use super::*;
525525

datafusion/core/src/datasource/listing/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ mod helpers;
2222
mod table;
2323
mod url;
2424

25-
use crate::error::Result;
2625
use chrono::TimeZone;
26+
use datafusion_common::Result;
2727
use datafusion_common::{ScalarValue, Statistics};
2828
use futures::Stream;
2929
use object_store::{path::Path, ObjectMeta};
@@ -162,7 +162,7 @@ impl From<ObjectMeta> for PartitionedFile {
162162

163163
#[cfg(test)]
164164
mod tests {
165-
use crate::datasource::listing::ListingTableUrl;
165+
use super::ListingTableUrl;
166166
use datafusion_execution::object_store::{
167167
DefaultObjectStoreRegistry, ObjectStoreRegistry,
168168
};

datafusion/core/src/datasource/listing/table.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ use std::{any::Any, sync::Arc};
2424
use super::helpers::{expr_applicable_for_cols, pruned_partition_list, split_files};
2525
use super::PartitionedFile;
2626

27-
use crate::catalog::TableProvider;
28-
use crate::datasource::{create_ordering, get_statistics_with_limit, TableType};
27+
use super::ListingTableUrl;
28+
use crate::datasource::{create_ordering, get_statistics_with_limit};
2929
use crate::datasource::{
3030
file_format::{file_compression_type::FileCompressionType, FileFormat},
31-
listing::ListingTableUrl,
3231
physical_plan::{FileScanConfig, FileSinkConfig},
3332
};
34-
use crate::{
35-
error::{DataFusionError, Result},
36-
execution::context::SessionState,
37-
logical_expr::{utils::conjunction, Expr, TableProviderFilterPushDown},
38-
physical_plan::{empty::EmptyExec, ExecutionPlan, Statistics},
39-
};
33+
use crate::execution::context::SessionState;
34+
use datafusion_catalog::TableProvider;
35+
use datafusion_common::{DataFusionError, Result};
36+
use datafusion_expr::TableType;
37+
use datafusion_expr::{utils::conjunction, Expr, TableProviderFilterPushDown};
38+
use datafusion_physical_plan::{empty::EmptyExec, ExecutionPlan, Statistics};
4039

4140
use arrow::datatypes::{DataType, Field, SchemaBuilder, SchemaRef};
4241
use arrow_schema::Schema;
@@ -1051,12 +1050,12 @@ mod tests {
10511050
use crate::datasource::file_format::parquet::ParquetFormat;
10521051
use crate::datasource::{provider_as_source, MemTable};
10531052
use crate::execution::options::ArrowReadOptions;
1054-
use crate::physical_plan::collect;
10551053
use crate::prelude::*;
10561054
use crate::{
10571055
assert_batches_eq,
10581056
test::{columns, object_store::register_test_store},
10591057
};
1058+
use datafusion_physical_plan::collect;
10601059

10611060
use arrow::record_batch::RecordBatch;
10621061
use arrow_schema::SortOptions;
@@ -1154,10 +1153,8 @@ mod tests {
11541153
let options = ListingOptions::new(Arc::new(ParquetFormat::default()));
11551154
let schema = options.infer_schema(&state, &table_path).await.unwrap();
11561155

1157-
use crate::{
1158-
datasource::file_format::parquet::ParquetFormat,
1159-
physical_plan::expressions::col as physical_col,
1160-
};
1156+
use crate::datasource::file_format::parquet::ParquetFormat;
1157+
use datafusion_physical_plan::expressions::col as physical_col;
11611158
use std::ops::Add;
11621159

11631160
// (file_sort_order, expected_result)

datafusion/core/src/datasource/listing/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::datasource::object_store::ObjectStoreUrl;
1918
use crate::execution::context::SessionState;
2019
use datafusion_common::{DataFusionError, Result};
20+
use datafusion_execution::object_store::ObjectStoreUrl;
2121
use datafusion_optimizer::OptimizerConfig;
2222
use futures::stream::BoxStream;
2323
use futures::{StreamExt, TryStreamExt};

0 commit comments

Comments
 (0)