Skip to content

[core] Preserve quoted empty and null keys/values in string-to-MAP cast - #9849

Open
wangyusheng1985 wants to merge 1 commit into
apache:masterfrom
wangyusheng1985:repo-agent/6cf10689-9782
Open

wangyusheng1985 wants to merge 1 commit into
apache:masterfrom
wangyusheng1985:repo-agent/6cf10689-9782

Conversation

@wangyusheng1985

Copy link
Copy Markdown

Purpose

String-to-MAP casting split entries first and then used a regex to separate key from value, so quote state for the individual key or value was gone by the time parseValue ran. {"" -> a} lost the empty key and {k -> "null"} became a SQL NULL value.

This change splits entries and then key/value with TokenSplitter.splitRaw so quotes survive, then parses each side through TokenSplitter.split the same way ARRAY and ROW already do.

Fixes #9782

Tests

mvn -pl paimon-common -DwildcardSuites=none -Dtest=CastExecutorTest spotless:check test passed (46 tests). Coverage includes quoted empty keys/values, quoted vs unquoted null, escaped null, quotes around -> and ,, and the MAP() function form.

Validation observed for this change:

  • mvn -pl paimon-common -DwildcardSuites=none -Dtest=CastExecutorTest spotless:check test

Fixes #9782

Signed-off-by: wangyusheng1985 <wangyusheng1985@users.noreply.github.com>
@wangyusheng1985
wangyusheng1985 marked this pull request as ready for review September 15, 2026 12:49
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] Quoting in the string-to-MAP cast rule cannot express an empty or literal-null key or value

1 participant