apache / apache/paimon

[Bug] Quoting in the string-to-MAP cast rule cannot express an empty or literal-null key or value

Open
#9,782 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.4k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
396

Description

The three string-to-collection cast rules share a mini-language where quotes group a token across separators. `StringToArrayCastRule` and `StringToRowCastRule` now remember whether a token was quoted, so `""` yields the empty string and `"null"` yields the four-character string rather than SQL NULL.

`StringToMapCastRule` still cannot do either. Its splitter works at the entry level (`k -> v, k2 -> v2`) and hands each entry to `ENTRY_PATTERN` to separate key from value, so by the time `parseValue` runs, the quote state of the individual key or value is gone. `"" -> a` loses the empty key and `k -> "null"` becomes a null value.

Fixing it needs quote-aware key/value splitting inside an entry rather than a regex over the already-stripped text, which is why it was left out of the array and row change.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with StringToMapCastRule, especially its entry splitter, ENTRY_PATTERN, and parseValue flow; compare how StringToArrayCastRule and StringToRowCastRule retain quote state. Done means quoted empty keys or values remain empty strings and quoted "null" remains literal text, while unquoted null behavior is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.