Skip to content

Commit 6e21b7f

Browse files
authored
feat(iceberg-datafusion): make IcebergTableScan public (#1570)
DataFusion `ExecutionPlan` implementations are generally public, so that they can be inspected and munged by optimization rules. Our specific use case is to use `IcebergTableProvider` to plan files, and then pass those files (assuming no deletes) to DataFusion`s `ListingTable`.
1 parent 4f5d8e2 commit 6e21b7f

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

crates/integrations/datafusion/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use catalog::*;
2121
mod error;
2222
pub use error::*;
2323

24-
mod physical_plan;
24+
pub mod physical_plan;
2525
mod schema;
2626
pub mod table;
2727
pub use table::table_provider_factory::IcebergTableProviderFactory;

crates/integrations/datafusion/src/physical_plan/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
pub(crate) mod expr_to_predicate;
1919
pub(crate) mod metadata_scan;
2020
pub(crate) mod scan;
21+
pub use scan::IcebergTableScan;

crates/integrations/datafusion/src/physical_plan/scan.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::to_datafusion_error;
3939
/// Manages the scanning process of an Iceberg [`Table`], encapsulating the
4040
/// necessary details and computed properties required for execution planning.
4141
#[derive(Debug)]
42-
pub(crate) struct IcebergTableScan {
42+
pub struct IcebergTableScan {
4343
/// A table in the catalog.
4444
table: Table,
4545
/// Snapshot of the table to scan.
@@ -79,6 +79,22 @@ impl IcebergTableScan {
7979
}
8080
}
8181

82+
pub fn table(&self) -> &Table {
83+
&self.table
84+
}
85+
86+
pub fn snapshot_id(&self) -> Option<i64> {
87+
self.snapshot_id
88+
}
89+
90+
pub fn projection(&self) -> Option<&[String]> {
91+
self.projection.as_deref()
92+
}
93+
94+
pub fn predicates(&self) -> Option<&Predicate> {
95+
self.predicates.as_ref()
96+
}
97+
8298
/// Computes [`PlanProperties`] used in query optimization.
8399
fn compute_properties(schema: ArrowSchemaRef) -> PlanProperties {
84100
// TODO:

0 commit comments

Comments
 (0)