Skip to content

Commit

Permalink
use purified for schema change
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Jan 15, 2025
1 parent b599ec8 commit 503f070
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/frontend/src/handler/alter_table_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub async fn get_new_table_definition_for_cdc_table(
);

// Retrieve the original table definition.
// TODO(purify): use purified definition.
let mut definition = original_catalog.create_sql_ast()?;

// Clear the original columns field, so that we'll follow `new_columns` to generate a
Expand Down Expand Up @@ -260,8 +259,7 @@ pub async fn handle_alter_table_column(
}

// Retrieve the original table definition and parse it to AST.
// TODO(purify): use purified definition.
let mut definition = original_catalog.create_sql_ast()?;
let mut definition = original_catalog.create_sql_ast_purified()?;
let Statement::CreateTable {
columns,
format_encode,
Expand Down
4 changes: 1 addition & 3 deletions src/frontend/src/handler/alter_table_with_sr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::error::{ErrorCode, Result};
use crate::TableCatalog;

fn get_format_encode_from_table(table: &TableCatalog) -> Result<Option<FormatEncodeOptions>> {
// TODO(purify): use purified definition.
let stmt = table.create_sql_ast()?;
let Statement::CreateTable { format_encode, .. } = stmt else {
unreachable!()
Expand Down Expand Up @@ -58,9 +57,8 @@ pub async fn handle_refresh_schema(
.into());
}

// Not using the purified definition because we want to re-fetch the schema.
let definition = original_table
.create_sql_ast()
.create_sql_ast_purified()
.context("unable to parse original table definition")?;

let (source, table, graph, col_index_mapping, job_type) = {
Expand Down
3 changes: 1 addition & 2 deletions src/frontend/src/handler/create_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ pub(crate) async fn reparse_table_for_sink(
table_catalog: &Arc<TableCatalog>,
) -> Result<(StreamFragmentGraph, Table, Option<PbSource>)> {
// Retrieve the original table definition and parse it to AST.
// TODO(purify): use purified definition.
let definition = table_catalog.create_sql_ast()?;
let definition = table_catalog.create_sql_ast_purified()?;
let Statement::CreateTable {
name,
format_encode,
Expand Down

0 comments on commit 503f070

Please sign in to comment.