Skip to content

Commit

Permalink
remove redundent column name
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Dec 25, 2023
1 parent e7e23b7 commit 527d76d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
7 changes: 1 addition & 6 deletions src/metric-engine/src/engine/alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@ impl MetricEngineInner {
// register columns to logical region
for col in columns {
self.metadata_region
.add_column(
metadata_region_id,
region_id,
&col.column_metadata.column_schema.name,
&col.column_metadata,
)
.add_column(metadata_region_id, region_id, &col.column_metadata)
.await?;
}

Expand Down
14 changes: 2 additions & 12 deletions src/metric-engine/src/engine/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,7 @@ impl MetricEngineInner {
.await?;
for col in &request.column_metadatas {
self.metadata_region
.add_column(
metadata_region_id,
logical_region_id,
&col.column_schema.name,
col,
)
.add_column(metadata_region_id, logical_region_id, col)
.await?;
}

Expand Down Expand Up @@ -221,12 +216,7 @@ impl MetricEngineInner {
// register columns to metadata region
for col in &new_columns {
self.metadata_region
.add_column(
metadata_region_id,
logical_region_id,
&col.column_schema.name,
col,
)
.add_column(metadata_region_id, logical_region_id, col)
.await?;
}

Expand Down
18 changes: 4 additions & 14 deletions src/metric-engine/src/metadata_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ impl MetadataRegion {
&self,
physical_region_id: RegionId,
logical_region_id: RegionId,
column_name: &str,
column_metadata: &ColumnMetadata,
) -> Result<bool> {
let region_id = utils::to_metadata_region_id(physical_region_id);
let column_key = Self::concat_column_key(logical_region_id, column_name);
let column_key =
Self::concat_column_key(logical_region_id, &column_metadata.column_schema.name);

self.put_if_absent(
region_id,
Expand Down Expand Up @@ -629,12 +629,7 @@ mod test {
column_id: 5,
};
metadata_region
.add_column(
physical_region_id,
logical_region_id,
column_name,
&column_metadata,
)
.add_column(physical_region_id, logical_region_id, &column_metadata)
.await
.unwrap();
let actual_semantic_type = metadata_region
Expand All @@ -645,12 +640,7 @@ mod test {

// duplicate column won't be updated
let is_updated = metadata_region
.add_column(
physical_region_id,
logical_region_id,
column_name,
&column_metadata,
)
.add_column(physical_region_id, logical_region_id, &column_metadata)
.await
.unwrap();
assert!(!is_updated);
Expand Down

0 comments on commit 527d76d

Please sign in to comment.