Serge Rielau created SPARK-60108:
------------------------------------
Summary: JSON CHAR/VARCHAR map keys: exact-width CHAR, no VARCHAR
trim
Key: SPARK-60108
URL: https://issues.apache.org/jira/browse/SPARK-60108
Project: Spark
Issue Type: Sub-task
Components: Spark Core
Affects Versions: 5.0.0
Reporter: Serge Rielau
When spark.sql.charVarchar.standardSemantics.enabled is true, from_json and the
JSON datasource already apply CHAR pad and VARCHAR overflow to values in
JacksonParser (SPARK-59274). JSON map keys are still taken as the raw object
names.
Apply length checks to keys in the tokenizer (convertMap / parser.currentName).
Do not rewrite keys.
MAP<CHAR(n), _>
Length < n: error (do not pad).
Length > n: EXCEED_LIMIT_LENGTH.
Length = n: keep as-is.
MAP<VARCHAR(n), _>
Length > n: EXCEED_LIMIT_LENGTH.
Otherwise keep as-is. Do not trim trailing spaces.
Do not call charTypeWriteSideCheck / varcharTypeWriteSideCheck on keys (those
pad and trim). Add key-specific helpers. CHAR-too-short must not be worded as
overflow.
Exact repeated JSON member names stay last-wins. Pad/trim collisions cannot
occur; do not run mapKeyDedupPolicy for CHAR/VARCHAR key assignment.
Length failures are parse-mode errors for the whole value. Flag off is
unchanged. Values, CSV, XML, and TRANSFORM are out of scope.
Tests: too-short CHAR key; exact-width CHAR key with spaces; CHAR/VARCHAR
overflow; VARCHAR "ab" vs "ab " remain distinct; exact duplicate names
last-wins; PERMISSIVE vs FAILFAST; nested maps; from_json and the JSON
datasource.
Docs: one migration-guide bullet for JSON CHAR/VARCHAR keys under the flag.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]