Skip to content

Commit f059485

Browse files
committed
fix CR
1 parent 19cd346 commit f059485

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

proxy/src/lib.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ impl Proxy {
323323
part_info: &PartitionInfo,
324324
) -> Result<TableInfo> {
325325
let get_inner = |i| async move {
326+
// TODO: the remote engine should provide a method to get all sub table names.
326327
let sub_partition_table_name = util::get_sub_partition_name(base_name, part_info, i);
327328
let table = self
328329
.instance
@@ -344,16 +345,12 @@ impl Proxy {
344345
Ok(table)
345346
};
346347

347-
let part_num = part_info.get_definition_num();
348-
if part_num == 1 {
349-
return get_inner(0).await;
350-
}
351-
352-
// Loop get sub tables to get table info in case of some of them has problems.
353-
for i in 0..part_info.get_definition_num() - 1 {
348+
let part_num = part_info.get_partition_num();
349+
// Loop all sub tables to get table info in case of some of them has problems.
350+
for i in 0..part_num - 1 {
354351
let ret = get_inner(i).await;
355-
if let Err(err) = ret {
356-
warn!("Failed to get table info, err:{err:?}");
352+
if let Err(e) = ret {
353+
warn!("Failed to get table info, err:{e:?}");
357354
} else {
358355
return ret;
359356
}
@@ -432,7 +429,7 @@ impl Proxy {
432429
let partition_table_info = table_info_in_meta.unwrap();
433430

434431
// If table not exists, open it.
435-
let table = self
432+
let table_info = self
436433
.get_partition_table_info(
437434
catalog_name,
438435
schema_name,
@@ -447,9 +444,9 @@ impl Proxy {
447444
catalog_name: catalog_name.to_string(),
448445
schema_name: schema_name.to_string(),
449446
table_name: partition_table_info.name,
450-
table_schema: table.table_schema,
451-
engine: table.engine,
452-
table_options: table.options,
447+
table_schema: table_info.table_schema,
448+
engine: table_info.engine,
449+
table_options: table_info.options,
453450
partition_info: partition_table_info.partition_info,
454451
};
455452
let create_table_request = CreateTableRequest {

table_engine/src/partition/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl PartitionInfo {
100100
}
101101

102102
#[inline]
103-
pub fn get_definition_num(&self) -> usize {
103+
pub fn get_partition_num(&self) -> usize {
104104
match self {
105105
Self::Random(v) => v.definitions.len(),
106106
Self::Hash(v) => v.definitions.len(),

0 commit comments

Comments
 (0)