Skip to content

[FLINK-39833][pipeline][starrocks] Escape special characters in column comment and default value when building DDL#4425

Open
linguoxuan wants to merge 1 commit into
apache:masterfrom
linguoxuan:0603_gxl
Open

[FLINK-39833][pipeline][starrocks] Escape special characters in column comment and default value when building DDL#4425
linguoxuan wants to merge 1 commit into
apache:masterfrom
linguoxuan:0603_gxl

Conversation

@linguoxuan
Copy link
Copy Markdown
Contributor

When the StarRocks pipeline connector builds DDL statements (CREATE TABLE / ALTER TABLE ADD COLUMN), special characters in column comments and default values (such as backslash \, double quote ", newline \n, carriage return \r) are not properly escaped.

This causes the generated DDL to be syntactically invalid, leading to schema synchronization failures at runtime.

Root Cause

The column comment and default value strings are directly interpolated into the DDL template DEFAULT "..." and COMMENT "..." without any escaping.

Fix

Introduce a utility method StarRocksUtils.escapeSqlStringLiteral() that escapes:

  • \\\
  • """
  • \n / \r → space

Apply this escaping in:

  • StarRocksEnrichedCatalog (CREATE TABLE DDL building)
  • StarRocksMetadataApplier (ALTER TABLE ADD COLUMN)
  • StarRocksUtils (initial schema conversion and table comment)

…n comment and default value when building DDL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant