@@ -17,10 +17,8 @@ use fancy_regex::Regex;
17
17
use pgwire:: pg_response:: { PgResponse , StatementType } ;
18
18
use risingwave_common:: bail_not_implemented;
19
19
use risingwave_sqlparser:: ast:: { FormatEncodeOptions , ObjectName , Statement } ;
20
- use risingwave_sqlparser:: parser:: Parser ;
21
20
use thiserror_ext:: AsReport ;
22
21
23
- use super :: alter_source_with_sr:: alter_definition_format_encode;
24
22
use super :: alter_table_column:: fetch_table_catalog_for_alter;
25
23
use super :: create_source:: schema_has_schema_registry;
26
24
use super :: util:: SourceSchemaCompatExt ;
@@ -48,32 +46,22 @@ pub async fn handle_refresh_schema(
48
46
bail_not_implemented ! ( "alter table with incoming sinks" ) ;
49
47
}
50
48
51
- let format_encode = {
52
- let format_encode = get_format_encode_from_table ( & original_table) ?;
53
- if !format_encode
54
- . as_ref ( )
55
- . is_some_and ( schema_has_schema_registry)
56
- {
57
- return Err ( ErrorCode :: NotSupported (
58
- "tables without schema registry cannot refreshed" . to_owned ( ) ,
59
- "try `ALTER TABLE .. ADD/DROP COLUMN ...` instead" . to_owned ( ) ,
60
- )
61
- . into ( ) ) ;
62
- }
63
- format_encode. unwrap ( )
64
- } ;
65
-
66
- // NOTE(st1page): since we have not implemented alter format encode for table, it is actually no use.
67
- // TODO(purify): use purified definition.
68
- let definition = alter_definition_format_encode (
69
- & original_table. definition ,
70
- format_encode. row_options . clone ( ) ,
71
- ) ?;
49
+ let format_encode = get_format_encode_from_table ( & original_table) ?;
50
+ if !format_encode
51
+ . as_ref ( )
52
+ . is_some_and ( schema_has_schema_registry)
53
+ {
54
+ return Err ( ErrorCode :: NotSupported (
55
+ "tables without schema registry cannot be refreshed" . to_owned ( ) ,
56
+ "try `ALTER TABLE .. ADD/DROP COLUMN ...` instead" . to_owned ( ) ,
57
+ )
58
+ . into ( ) ) ;
59
+ }
72
60
73
- let [ definition ] : [ _ ; 1 ] = Parser :: parse_sql ( & definition)
74
- . context ( "unable to parse original table definition" ) ?
75
- . try_into ( )
76
- . unwrap ( ) ;
61
+ // Not using the purified definition because we want to re-fetch the schema.
62
+ let definition = original_table
63
+ . create_sql_ast ( )
64
+ . context ( "unable to parse original table definition" ) ? ;
77
65
78
66
let ( source, table, graph, col_index_mapping, job_type) = {
79
67
let result =
0 commit comments