Skip to content

Preserve quoted semicolons when importing table schemas - #19457

Open
DaZuiZui wants to merge 1 commit into
apache:masterfrom
DaZuiZui:codex/table-schema-quoted-semicolon
Open

DaZuiZui wants to merge 1 commit into
apache:masterfrom
DaZuiZui:codex/table-schema-quoted-semicolon

Conversation

@DaZuiZui

Copy link
Copy Markdown
Contributor

Description

Fixes #19456

Table-model schema imports split each input line on every semicolon. For a column defined with COMMENT 'intake; exhaust', an exported schema first drops the target table, then submits two incomplete CREATE fragments. The target table is left missing.

Use the existing table-model SQL lexer to recognize statement delimiters. Process tokens as the input is read, preserve whitespace and newlines within statements, and submit the last statement at EOF even when its terminating semicolon is omitted.

Verification

  • Added four unit tests covering the reported column comment, quoted identifiers, doubled quotes, multiline input, SQL comments, adjacent statements, and EOF. All 22 CLI module tests passed.
  • Ran the distribution's export-schema.sh and import-schema.sh against a local ConfigNode and DataNode. The original importer left the target table missing and wrote a .failed file. With this change, the same export recreated the target with the complete intake; exhaust comment. Its SHOW CREATE TABLE matched the source exactly, and the control case with intake exhaust also passed.

This PR has:

  • been self-reviewed.
  • added unit tests for the changed behavior.
  • been tested in a test IoTDB cluster.

Key changed/added classes
  • ImportSchemaTable
  • ImportSchemaTableTest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Table schema import splits column comments at semicolons and fails to recreate the target table

1 participant