Skip to content

Commit 6887233

Browse files
authored
fix: trim object preix error (#17636)
* fix trim_object_prefix * add ut * fix
1 parent 43a538f commit 6887233

File tree

1 file changed

+5
-1
lines changed
  • src/query/storages/common/table_meta/src/meta

1 file changed

+5
-1
lines changed

src/query/storages/common/table_meta/src/meta/utils.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub fn parse_storage_prefix(options: &BTreeMap<String, String>, table_id: u64) -
158158
pub fn trim_object_prefix(key: &str) -> &str {
159159
// if object key (the file_name/stem part only) starts with a char which is larger
160160
// than 'f', strip it off
161-
if key > "f" {
161+
if !key.is_empty() && key.chars().next().unwrap() > 'f' {
162162
&key[1..]
163163
} else {
164164
key
@@ -196,6 +196,10 @@ mod tests {
196196
"bucket/root/115/122/_b/0191114d30fd78b89fae8e5c88327725_v2.parquet",
197197
"0191114d30fd78b89fae8e5c88327725",
198198
),
199+
(
200+
"bucket/root/115/122/_b/f191114d30fd78b89fae8e5c88327725_v2.parquet",
201+
"f191114d30fd78b89fae8e5c88327725",
202+
),
199203
];
200204

201205
for (input, expected) in test_cases {

0 commit comments

Comments
 (0)