From 274fb0706ba0a8e54fd353e34f61858ea140d577 Mon Sep 17 00:00:00 2001 From: Sergei Patiakin Date: Thu, 28 Nov 2024 15:58:44 +0100 Subject: [PATCH 1/3] Expose IcebergTableProvider.table --- crates/integrations/datafusion/src/table/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/integrations/datafusion/src/table/mod.rs b/crates/integrations/datafusion/src/table/mod.rs index 00c9e1322..353f58e66 100644 --- a/crates/integrations/datafusion/src/table/mod.rs +++ b/crates/integrations/datafusion/src/table/mod.rs @@ -107,6 +107,10 @@ impl IcebergTableProvider { schema, }) } + + pub fn table(&self) -> Table { + self.table.clone() + } } #[async_trait] From 3cdb1e171629f6f63fc9140e8d5cbd516993ac6e Mon Sep 17 00:00:00 2001 From: Sergei Patiakin Date: Thu, 28 Nov 2024 17:31:01 +0100 Subject: [PATCH 2/3] Set table metadata --- crates/iceberg/src/table.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/iceberg/src/table.rs b/crates/iceberg/src/table.rs index 406f9dd65..a022398c3 100644 --- a/crates/iceberg/src/table.rs +++ b/crates/iceberg/src/table.rs @@ -265,7 +265,14 @@ impl StaticTable { let metadata_file = file_io.new_input(metadata_file_path)?; let metadata_file_content = metadata_file.read().await?; let table_metadata = serde_json::from_slice::(&metadata_file_content)?; - Self::from_metadata(table_metadata, table_ident, file_io).await + let table = Table::builder() + .metadata(table_metadata) + .metadata_location(metadata_file_path) + .identifier(table_ident) + .file_io(file_io.clone()) + .readonly(true) + .build()?; + Ok(Self(table)) } /// Create a TableScanBuilder for the static table. From 6e87893e733379558df597aa7d66f026549e3b0c Mon Sep 17 00:00:00 2001 From: Sergei Patiakin Date: Tue, 10 Dec 2024 12:37:37 +0100 Subject: [PATCH 3/3] Revert crates/iceberg/src/table.rs --- crates/iceberg/src/table.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crates/iceberg/src/table.rs b/crates/iceberg/src/table.rs index a022398c3..406f9dd65 100644 --- a/crates/iceberg/src/table.rs +++ b/crates/iceberg/src/table.rs @@ -265,14 +265,7 @@ impl StaticTable { let metadata_file = file_io.new_input(metadata_file_path)?; let metadata_file_content = metadata_file.read().await?; let table_metadata = serde_json::from_slice::(&metadata_file_content)?; - let table = Table::builder() - .metadata(table_metadata) - .metadata_location(metadata_file_path) - .identifier(table_ident) - .file_io(file_io.clone()) - .readonly(true) - .build()?; - Ok(Self(table)) + Self::from_metadata(table_metadata, table_ident, file_io).await } /// Create a TableScanBuilder for the static table.