Skip to content

[common] Preserve NULL values in complex default literals - #11312

Open
zhangyue19921010 wants to merge 4 commits into
apache:masterfrom
zhangyue19921010:contrib/preserve-complex-null-literals-20261121
Open

zhangyue19921010 wants to merge 4 commits into
apache:masterfrom
zhangyue19921010:contrib/preserve-complex-null-literals-20261121

Conversation

@zhangyue19921010

Copy link
Copy Markdown
Contributor

Purpose

Fixes #11311

Creating a table with defaults such as ARRAY(1, NULL), MAP(1, NULL) or STRUCT(1, NULL) fails because the complex cast rules treat uppercase NULL as a value to parse. Whole-value NULL defaults also fail for ARRAY and ROW.

Recognize unquoted NULL case-insensitively and add whole-value NULL handling to ARRAY and ROW. Quoted and escaped null strings remain literal text. Projecting a NULL row default also preserves NULL.

Tests

Added Spark SQL create/write/read regressions and cast tests for lowercase, uppercase and mixed-case NULL, including quoted and escaped string controls. On unchanged production code, all four new Spark regressions fail and the four existing controls pass; the focused cast baseline has eight parser errors in ten cases.

All 77 tests in CastExecutorTest, DefaultValueRowTest, CastedRowTest and Spark DefaultValueTest pass with normal Maven checks enabled (JDK 11, Spark 3.5.9). Coverage includes projecting a NULL row default.

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] Complex default values reject SQL NULL literals

1 participant