Skip to content

Commit

Permalink
some rename
Browse files Browse the repository at this point in the history
  • Loading branch information
st1page committed Nov 5, 2024
1 parent e63b32b commit 322cbf0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/frontend/src/handler/alter_table_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ fn to_ast_data_type(ty: &DataType) -> Result<AstDataType> {
pub async fn get_replace_table_plan(
session: &Arc<SessionImpl>,
table_name: ObjectName,
definition: Statement,
original_catalog: &Arc<TableCatalog>,
new_definition: Statement,
old_catalog: &Arc<TableCatalog>,
format_encode: Option<FormatEncodeOptions>,
new_version_columns: Option<Vec<ColumnCatalog>>, // only provided in auto schema change
) -> Result<(
Expand All @@ -150,8 +150,8 @@ pub async fn get_replace_table_plan(
TableJobType,
)> {
// Create handler args as if we're creating a new table with the altered definition.
let handler_args = HandlerArgs::new(session.clone(), &definition, Arc::from(""))?;
let col_id_gen = ColumnIdGenerator::new_alter(original_catalog);
let handler_args = HandlerArgs::new(session.clone(), &new_definition, Arc::from(""))?;
let col_id_gen = ColumnIdGenerator::new_alter(old_catalog);
let Statement::CreateTable {
columns,
constraints,
Expand All @@ -162,15 +162,15 @@ pub async fn get_replace_table_plan(
wildcard_idx,
cdc_table_info,
..
} = definition
} = new_definition
else {
panic!("unexpected statement type: {:?}", definition);
panic!("unexpected statement type: {:?}", new_definition);
};

let (mut graph, table, source, job_type) = generate_stream_graph_for_replace_table(
session,
table_name,
original_catalog,
old_catalog,
format_encode,
handler_args.clone(),
col_id_gen,
Expand All @@ -188,7 +188,7 @@ pub async fn get_replace_table_plan(

// Calculate the mapping from the original columns to the new columns.
let col_index_mapping = ColIndexMapping::new(
original_catalog
old_catalog
.columns()
.iter()
.map(|old_c| {
Expand All @@ -200,7 +200,7 @@ pub async fn get_replace_table_plan(
table.columns.len(),
);

let incoming_sink_ids: HashSet<_> = original_catalog.incoming_sinks.iter().copied().collect();
let incoming_sink_ids: HashSet<_> = old_catalog.incoming_sinks.iter().copied().collect();

let target_columns = table
.columns
Expand All @@ -220,7 +220,7 @@ pub async fn get_replace_table_plan(
// Set some fields ourselves so that the meta service does not need to maintain them.
let mut table = table;
table.incoming_sinks = incoming_sink_ids.iter().copied().collect();
table.maybe_vnode_count = VnodeCount::set(original_catalog.vnode_count()).to_protobuf();
table.maybe_vnode_count = VnodeCount::set(old_catalog.vnode_count()).to_protobuf();

Ok((source, table, graph, col_index_mapping, job_type))
}
Expand Down

0 comments on commit 322cbf0

Please sign in to comment.