liurenjie1024 commented on code in PR #1623:
URL: https://github.com/apache/iceberg-rust/pull/1623#discussion_r2297715785


##########
crates/iceberg/src/catalog/memory/catalog.rs:
##########
@@ -24,17 +24,84 @@ use futures::lock::{Mutex, MutexGuard};
 use itertools::Itertools;
 
 use super::namespace_state::NamespaceState;
-use crate::io::FileIO;
+use crate::io::{FileIO, FileIOBuilder};
 use crate::spec::{TableMetadata, TableMetadataBuilder};
 use crate::table::Table;
 use crate::{
-    Catalog, Error, ErrorKind, MetadataLocation, Namespace, NamespaceIdent, 
Result, TableCommit,
-    TableCreation, TableIdent,
+    Catalog, CatalogBuilder, Error, ErrorKind, MetadataLocation, Namespace, 
NamespaceIdent, Result,
+    TableCommit, TableCreation, TableIdent,
 };
 
+/// Memory catalog io type
+pub const MEMORY_CATALOG_IO_TYPE: &str = "io_type";
+/// Memory catalog warehouse location
+pub const MEMORY_CATALOG_WAREHOUSE: &str = "warehouse";
+
 /// namespace `location` property
 const LOCATION: &str = "location";
 
+/// Builder for [`MemoryCatalog`].
+#[derive(Debug)]
+pub struct MemoryCatalogBuilder(MemoryCatalogConfig);
+
+impl Default for MemoryCatalogBuilder {
+    fn default() -> Self {
+        Self(MemoryCatalogConfig {
+            name: None,
+            io_type: None,
+            warehouse: None,
+            props: HashMap::new(),
+        })
+    }
+}
+
+impl CatalogBuilder for MemoryCatalogBuilder {
+    type C = MemoryCatalog;
+
+    fn load(
+        mut self,
+        name: impl Into<String>,
+        props: HashMap<String, String>,
+    ) -> impl Future<Output = Result<Self::C>> + Send {
+        self.0.name = Some(name.into());
+
+        if props.contains_key(MEMORY_CATALOG_IO_TYPE) {
+            self.0.io_type = props.get(MEMORY_CATALOG_IO_TYPE).cloned()
+        }

Review Comment:
   I don't think we need this, we could infer from `MEMORY_CATALOG_WAREHOUSE`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to