xushiyan commented on code in PR #163:
URL: https://github.com/apache/hudi-rs/pull/163#discussion_r1797629237
##########
crates/core/src/table/mod.rs:
##########
@@ -180,91 +169,6 @@ impl Table {
.register_object_store(runtime_env.clone());
}
- async fn load_configs<I, K, V>(
Review Comment:
some of these util functions were updated in main
##########
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:
a builder pattern is helpful for users. can you design such that it takes in
generic options? we don't have to distinguish hudi option vs storage option
from the user side, the build() function should handle it internally.
--
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]