sdd commented on code in PR #1297: URL: https://github.com/apache/iceberg-rust/pull/1297#discussion_r2083900311
########## crates/integrations/datafusion/src/table/mod.rs: ########## @@ -38,55 +39,63 @@ use crate::physical_plan::scan::IcebergTableScan; #[derive(Debug, Clone)] pub struct IcebergTableProvider { /// A table in the catalog. - table: Table, + table: Arc<RwLock<Table>>, + /// The identifier to the table in the catalog. + table_identifier: TableIdent, /// Table snapshot id that will be queried via this provider. snapshot_id: Option<i64>, /// A reference-counted arrow `Schema`. schema: ArrowSchemaRef, + /// A reference to the catalog that this table provider belongs to. + catalog: Option<Arc<dyn Catalog>>, } impl IcebergTableProvider { pub(crate) fn new(table: Table, schema: ArrowSchemaRef) -> Self { + let table_identifier = table.identifier().clone(); IcebergTableProvider { - table, + table: Arc::new(RwLock::new(table)), + table_identifier, snapshot_id: None, schema, + catalog: None, } } /// Asynchronously tries to construct a new [`IcebergTableProvider`] /// using the given client and table name to fetch an actual [`Table`] /// in the provided namespace. - pub(crate) async fn try_new( - client: Arc<dyn Catalog>, - namespace: NamespaceIdent, - name: impl Into<String>, - ) -> Result<Self> { - let ident = TableIdent::new(namespace, name.into()); - let table = client.load_table(&ident).await?; + pub async fn try_new(client: Arc<dyn Catalog>, table_name: TableIdent) -> Result<Self> { Review Comment: Unless this is a DataFusion convention that I'm not aware of :-) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org