Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(frontend): use purified definition for altering source #20182

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix unit test
Signed-off-by: Bugen Zhao <[email protected]>
BugenZhao committed Jan 17, 2025
commit e1f410dcba3668323cbdd71025bfe3dc80f2b895
9 changes: 4 additions & 5 deletions src/frontend/src/handler/alter_source_with_sr.rs
Original file line number Diff line number Diff line change
@@ -382,6 +382,9 @@ pub mod tests {
.clone()
};

let source = get_source();
expect_test::expect!["CREATE SOURCE src (id INT, country STRUCT<address CHARACTER VARYING, city STRUCT<address CHARACTER VARYING, zipcode CHARACTER VARYING>, zipcode CHARACTER VARYING>, zipcode BIGINT, rate REAL) WITH (connector = 'kafka', topic = 'test-topic', properties.bootstrap.server = 'localhost:29092') FORMAT PLAIN ENCODE PROTOBUF (message = '.test.TestRecord', schema.location = 'file://')"].assert_eq(&source.create_sql_purified().replace(proto_file.path().to_str().unwrap(), ""));

let sql = format!(
r#"ALTER SOURCE src FORMAT UPSERT ENCODE PROTOBUF (
message = '.test.TestRecord',
@@ -425,10 +428,6 @@ pub mod tests {
.unwrap();
assert_eq!(name_column.column_desc.data_type, DataType::Varchar);

let altered_sql = format!(
r#"CREATE SOURCE src WITH (connector = 'kafka', topic = 'test-topic', properties.bootstrap.server = 'localhost:29092') FORMAT PLAIN ENCODE PROTOBUF (message = '.test.TestRecordExt', schema.location = 'file://{}')"#,
proto_file.path().to_str().unwrap()
);
assert_eq!(altered_sql, altered_source.definition);
expect_test::expect!["CREATE SOURCE src (id INT, country STRUCT<address CHARACTER VARYING, city STRUCT<address CHARACTER VARYING, zipcode CHARACTER VARYING>, zipcode CHARACTER VARYING>, zipcode BIGINT, rate REAL, name CHARACTER VARYING) WITH (connector = 'kafka', topic = 'test-topic', properties.bootstrap.server = 'localhost:29092') FORMAT PLAIN ENCODE PROTOBUF (message = '.test.TestRecordExt', schema.location = 'file://')"].assert_eq(&altered_source.create_sql_purified().replace(proto_file.path().to_str().unwrap(), ""));
}
}