You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by li...@apache.org on 2025/08/01 13:06:58 UTC

(iceberg-rust) branch main updated: feat(iceberg-datafusion): make IcebergTableScan public (#1570)

This is an automated email from the ASF dual-hosted git repository.

liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 6e21b7fc feat(iceberg-datafusion): make IcebergTableScan public (#1570)
6e21b7fc is described below

commit 6e21b7fcfff2819e7d764b17eff066ed3424ccd5
Author: Colin Marc <hi...@colinmarc.com>
AuthorDate: Fri Aug 1 15:06:53 2025 +0200

    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`.
---
 crates/integrations/datafusion/src/lib.rs              |  2 +-
 .../integrations/datafusion/src/physical_plan/mod.rs   |  1 +
 .../integrations/datafusion/src/physical_plan/scan.rs  | 18 +++++++++++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/crates/integrations/datafusion/src/lib.rs b/crates/integrations/datafusion/src/lib.rs
index 2316d2b7..09d1cac4 100644
--- a/crates/integrations/datafusion/src/lib.rs
+++ b/crates/integrations/datafusion/src/lib.rs
@@ -21,7 +21,7 @@ pub use catalog::*;
 mod error;
 pub use error::*;
 
-mod physical_plan;
+pub mod physical_plan;
 mod schema;
 pub mod table;
 pub use table::table_provider_factory::IcebergTableProviderFactory;
diff --git a/crates/integrations/datafusion/src/physical_plan/mod.rs b/crates/integrations/datafusion/src/physical_plan/mod.rs
index 58fb065d..e424b690 100644
--- a/crates/integrations/datafusion/src/physical_plan/mod.rs
+++ b/crates/integrations/datafusion/src/physical_plan/mod.rs
@@ -18,3 +18,4 @@
 pub(crate) mod expr_to_predicate;
 pub(crate) mod metadata_scan;
 pub(crate) mod scan;
+pub use scan::IcebergTableScan;
diff --git a/crates/integrations/datafusion/src/physical_plan/scan.rs b/crates/integrations/datafusion/src/physical_plan/scan.rs
index f33437ee..d4751a19 100644
--- a/crates/integrations/datafusion/src/physical_plan/scan.rs
+++ b/crates/integrations/datafusion/src/physical_plan/scan.rs
@@ -39,7 +39,7 @@ use crate::to_datafusion_error;
 /// Manages the scanning process of an Iceberg [`Table`], encapsulating the
 /// necessary details and computed properties required for execution planning.
 #[derive(Debug)]
-pub(crate) struct IcebergTableScan {
+pub struct IcebergTableScan {
     /// A table in the catalog.
     table: Table,
     /// Snapshot of the table to scan.
@@ -79,6 +79,22 @@ impl IcebergTableScan {
         }
     }
 
+    pub fn table(&self) -> &Table {
+        &self.table
+    }
+
+    pub fn snapshot_id(&self) -> Option<i64> {
+        self.snapshot_id
+    }
+
+    pub fn projection(&self) -> Option<&[String]> {
+        self.projection.as_deref()
+    }
+
+    pub fn predicates(&self) -> Option<&Predicate> {
+        self.predicates.as_ref()
+    }
+
     /// Computes [`PlanProperties`] used in query optimization.
     fn compute_properties(schema: ArrowSchemaRef) -> PlanProperties {
         // TODO: