Skip to content

Commit 17226b8

Browse files
authored
feat: Add username support for webhdfs (#17350)
* feat: Add username support for webhdfs Signed-off-by: Xuanwo <[email protected]> * Fix test Signed-off-by: Xuanwo <[email protected]> --------- Signed-off-by: Xuanwo <[email protected]>
1 parent 12414d3 commit 17226b8

File tree

17 files changed

+129
-12
lines changed

17 files changed

+129
-12
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ num-derive = "0.3.3"
365365
num-traits = "0.2.19"
366366
num_cpus = "1.13.1"
367367
object = "0.36.5"
368-
object_store_opendal = { version = "0.49.0", package = "object_store_opendal", git = "https://github.com/apache/opendal", rev = "78b6a9f" }
368+
object_store_opendal = { version = "0.49.0", package = "object_store_opendal", git = "https://github.com/apache/opendal", rev = "b8a3b7a" }
369369
once_cell = "1.15.0"
370370
openai_api_rust = "0.1"
371-
opendal = { version = "0.51.1", package = "opendal", git = "https://github.com/apache/opendal", rev = "78b6a9f", features = [
371+
opendal = { version = "0.51.1", package = "opendal", git = "https://github.com/apache/opendal", rev = "b8a3b7a", features = [
372372
"layers-fastrace",
373373
"layers-prometheus-client",
374374
"layers-async-backtrace",

src/common/storage/src/operator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ fn init_webhdfs_operator(v: &StorageWebhdfsConfig) -> Result<impl Builder> {
358358
let mut builder = services::Webhdfs::default()
359359
.endpoint(&v.endpoint_url)
360360
.root(&v.root)
361-
.delegation(&v.delegation);
361+
.delegation(&v.delegation)
362+
.user_name(&v.user_name);
362363

363364
if v.disable_list_batch {
364365
builder = builder.disable_list_batch();

src/meta/app/src/storage/storage_params.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ pub struct StorageWebhdfsConfig {
523523
pub root: String,
524524
pub delegation: String,
525525
pub disable_list_batch: bool,
526+
pub user_name: String,
526527
}
527528

528529
impl Debug for StorageWebhdfsConfig {
@@ -531,7 +532,8 @@ impl Debug for StorageWebhdfsConfig {
531532

532533
ds.field("endpoint_url", &self.endpoint_url)
533534
.field("root", &self.root)
534-
.field("disable_list_batch", &self.disable_list_batch);
535+
.field("disable_list_batch", &self.disable_list_batch)
536+
.field("user_name", &self.user_name);
535537

536538
ds.field("delegation", &mask_string(&self.delegation, 3));
537539

src/meta/proto-conv/src/config_from_to_protobuf_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ impl FromToProto for StorageWebhdfsConfig {
262262
root: p.root,
263263
delegation: p.delegation,
264264
disable_list_batch: p.disable_list_batch,
265+
user_name: p.user_name,
265266
})
266267
}
267268

@@ -274,8 +275,7 @@ impl FromToProto for StorageWebhdfsConfig {
274275
delegation: self.delegation.clone(),
275276
disable_list_batch: self.disable_list_batch,
276277

277-
username: String::new(), // reserved for future use
278-
password: String::new(), // reserved for future use
278+
user_name: self.user_name.clone(),
279279
})
280280
}
281281
}

src/meta/proto-conv/src/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ const META_CHANGE_LOG: &[(u64, &str)] = &[
146146
(114, "2024-12-12: Add: New DataType Interval."),
147147
(115, "2024-12-16: Add: udf.proto: add UDAFScript and UDAFServer"),
148148
(116, "2025-01-09: Add: MarkedDeletedIndexMeta"),
149-
(117, "2025-01-21: Add: config.proto: add disable_list_batch in WebhdfsConfig")
149+
(117, "2025-01-21: Add: config.proto: add disable_list_batch in WebhdfsConfig"),
150+
(118, "2025-01-22: Add: config.proto: add user_name in WebhdfsConfig")
150151
// Dear developer:
151152
// If you're gonna add a new metadata version, you'll have to add a test for it.
152153
// You could just copy an existing test file(e.g., `../tests/it/v024_table_meta.rs`)

src/meta/proto-conv/tests/it/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ mod v114_interval_datatype;
115115
mod v115_add_udaf_script;
116116
mod v116_marked_deleted_index_meta;
117117
mod v117_webhdfs_add_disable_list_batch;
118+
mod v118_webhdfs_add_user_name;

src/meta/proto-conv/tests/it/user_proto_conv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ pub(crate) fn test_webhdfs_stage_info() -> mt::principal::StageInfo {
322322
root: "/path/to/stage/files".to_string(),
323323
delegation: "<delegation_token>".to_string(),
324324
disable_list_batch: false,
325+
user_name: String::new(),
325326
}),
326327
},
327328
is_temporary: false,

src/meta/proto-conv/tests/it/user_stage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ fn test_user_stage_webhdfs_v30() -> anyhow::Result<()> {
9595
root: "/path/to/stage/files".to_string(),
9696
delegation: "<delegation_token>".to_string(),
9797
disable_list_batch: false,
98+
user_name: String::new(),
9899
}),
99100
},
100101
file_format_params: mt::principal::FileFormatParams::Json(

src/meta/proto-conv/tests/it/v030_user_stage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ fn test_decode_v30_user_stage() -> anyhow::Result<()> {
5454
root: "/path/to/stage/files".to_string(),
5555
delegation: "<delegation_token>".to_string(),
5656
disable_list_batch: false,
57+
user_name: String::new(),
5758
}),
5859
},
5960
file_format_params: mt::principal::FileFormatParams::Json(

0 commit comments

Comments
 (0)