Skip to content

Commit

Permalink
chore: change ViewInfo::new signature
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed May 30, 2024
1 parent 9ec85d8 commit 4a2f7db
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/catalog/src/table_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ mod tests {
let logical_plan = vec![1, 2, 3];
// Create view metadata
table_metadata_manager
.create_view_metadata(view_info.clone().into(), &logical_plan, HashSet::new())
.create_view_metadata(view_info.clone().into(), logical_plan, HashSet::new())
.await
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/cache/table/view_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod tests {
table_metadata_manager
.create_view_metadata(
task.view_info.clone(),
&task.create_view.logical_plan,
task.create_view.logical_plan.clone(),
table_names,
)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/ddl/create_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl CreateViewProcedure {
manager
.create_view_metadata(
raw_view_info,
self.data.task.raw_logical_plan(),
self.data.task.raw_logical_plan().clone(),
self.data.task.table_names(),
)
.await?;
Expand Down
4 changes: 2 additions & 2 deletions src/common/meta/src/ddl/tests/create_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async fn test_on_prepare_view_exists_err() {
.table_metadata_manager
.create_view_metadata(
task.view_info.clone(),
&task.create_view.logical_plan,
task.create_view.logical_plan.clone(),
test_table_names(),
)
.await
Expand All @@ -126,7 +126,7 @@ async fn test_on_prepare_with_create_if_view_exists() {
.table_metadata_manager
.create_view_metadata(
task.view_info.clone(),
&task.create_view.logical_plan,
task.create_view.logical_plan.clone(),
test_table_names(),
)
.await
Expand Down
10 changes: 6 additions & 4 deletions src/common/meta/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl TableMetadataManager {
pub async fn create_view_metadata(
&self,
view_info: RawTableInfo,
raw_logical_plan: &Vec<u8>,
raw_logical_plan: Vec<u8>,
table_names: HashSet<TableName>,
) -> Result<()> {
let view_id = view_info.ident.table_id;
Expand Down Expand Up @@ -2009,7 +2009,7 @@ mod tests {

// Create metadata
table_metadata_manager
.create_view_metadata(view_info.clone(), &logical_plan, table_names.clone())
.create_view_metadata(view_info.clone(), logical_plan.clone(), table_names.clone())
.await
.unwrap();

Expand Down Expand Up @@ -2051,8 +2051,10 @@ mod tests {
set
};

let current_view_info_value =
DeserializedValueWithBytes::from_inner(ViewInfoValue::new(&logical_plan, table_names));
let current_view_info_value = DeserializedValueWithBytes::from_inner(ViewInfoValue::new(
logical_plan.clone(),
table_names,
));
// should be ok.
table_metadata_manager
.update_view_info(
Expand Down
4 changes: 2 additions & 2 deletions src/common/meta/src/key/view_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ pub struct ViewInfoValue {
}

impl ViewInfoValue {
pub fn new(view_info: &RawViewLogicalPlan, table_names: HashSet<TableName>) -> Self {
pub fn new(view_info: RawViewLogicalPlan, table_names: HashSet<TableName>) -> Self {
Self {
view_info: view_info.clone(),
view_info,
table_names,
version: 0,
}
Expand Down

0 comments on commit 4a2f7db

Please sign in to comment.