Skip to content

[AMORO-4423][Common] Escape Spark SQL literals in table-operation history - #4424

Merged
j1wonpark merged 2 commits into
apache:masterfrom
hutiefang76:frank/oss-spark-literals-20261007-01a11186
Oct 17, 2026
Merged

j1wonpark merged 2 commits into
apache:masterfrom
hutiefang76:frank/oss-spark-literals-20261007-01a11186

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Why are the changes needed?

Fixes #4423.

Generated table-operation history becomes invalid or changes values when properties/comments contain apostrophes or backslashes. Comment removal is emitted as the literal text null.

Brief change log

  • Escape backslashes before apostrophes and preserve newline, carriage-return and tab characters with Spark literal escapes.
  • Apply escaping to property keys/values, removed property keys and column comments.
  • Emit an empty literal for comment removal.

How was this patch tested?

  • Added deterministic regression tests.
  • Ran tests locally before making this pull request.
  • Screenshots (not applicable).

JDK 17: 10 tests passed in TestSparkMetadataChangeHandlerLiterals, including two DDLReverser history cases.

./mvnw -pl amoro-common -am -Pskip-dashboard-build -Dtest=TestSparkMetadataChangeHandlerLiterals -Dsurefire.failIfNoSpecifiedTests=false test

A separate local Spark 3.5.8 Catalyst check parsed five representative escaped literal values and the generated DDL successfully; it is a parser check, not a running Spark cluster test.

dev/reformat passed. Uses Spark's default string-literal parsing. No identifier-quoting or nullability change is included; literal tests use a distinct class to avoid a file-addition conflict with the nullability fix.

Documentation

  • Does this pull request introduce a new feature? No.
  • Feature documentation: not applicable; this corrects existing behavior.

AI assistance: DeepSeek and Codex assisted implementation, tests and this description.

@j1wonpark j1wonpark left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@j1wonpark
j1wonpark merged commit 6d3cd42 into apache:master Oct 17, 2026
7 of 8 checks passed
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.

[Bug]: Spark table-operation history does not escape string literals

2 participants