xushiyan commented on code in PR #163:
URL: https://github.com/apache/hudi-rs/pull/163#discussion_r1797681130


##########
crates/core/src/table/builder.rs:
##########
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use crate::config::{HudiConfigs, HUDI_CONF_DIR};
+use crate::storage::utils::{parse_config_data, parse_uri};
+use crate::storage::Storage;
+use crate::table::fs_view::FileSystemView;
+use crate::table::timeline::Timeline;
+use crate::table::Table;
+use anyhow::Context;
+use std::collections::HashMap;
+use std::env;
+use std::path::PathBuf;
+use std::sync::Arc;
+use url::Url;
+
+#[derive(Debug)]
+pub struct TableBuilder {
+    base_url: Url,
+    hudi_options: Option<HashMap<String, String>>,
+    storage_options: Option<HashMap<String, String>>,
+}
+
+impl TableBuilder {
+    pub fn from_uri(uri: &str) -> Self {
+        let base_url = parse_uri(uri).unwrap(); // TODO: handle err
+        TableBuilder {
+            base_url,
+            storage_options: None,
+            hudi_options: None,
+        }
+    }
+    pub fn with_hudi_options(mut self, hudi_options: HashMap<String, String>) 
-> Self {
+        self.hudi_options = Some(hudi_options);
+        self
+    }
+
+    pub fn with_storage_options(mut self, storage_options: HashMap<String, 
String>) -> Self {
+        self.storage_options = Some(storage_options);
+        self
+    }

Review Comment:
   @kazdy can you please clarify the benefit of using 
   
   ```
   TableBuilder::with_hudi_options()
   TableBuilder::with_storage_options()
   ```
   
   when there is a generic api to take options and resolve internally, why 
would you still want to use an explicit api? using a generic api is one less 
thing caller needs to worry about. From API design pov, it'll be redundant 
unless being explicit gives additional logic behind it. 



-- 
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]

Reply via email to