dejankrak-db commented on code in PR #56237:
URL: https://github.com/apache/spark/pull/56237#discussion_r3338711794
##########
sql/core/src/test/resources/sql-tests/inputs/extract-value-resolution-edge-cases.sql:
##########
@@ -8,3 +8,12 @@ SELECT col1.a, a FROM t1 ORDER BY col1.a;
SELECT split(col1, '-')[1] AS a FROM VALUES('a-b') ORDER BY split(col1,
'-')[1];
DROP TABLE t1;
+
+-- SPARK-57186: dotted multipart field access on a NullType base returns NULL
instead of throwing
+-- INVALID_EXTRACT_BASE_FIELD_TYPE (NULL propagation; a NullType column can
arise e.g. from schema
+-- evolution with missing columns). The fix is scoped to multipart name
resolution (`col.a`); the
+-- `col['key']` and `col[0]` forms go through UnresolvedExtractValue and still
throw, so the
+-- shared ExtractValue utility and the single-pass resolver are unaffected.
+SELECT col.a FROM (SELECT null AS col) t;
+SELECT col[0] FROM (SELECT null AS col) t;
Review Comment:
Under the legacy analyzer all three (`col.a`, `col[0]`, `col['key']`) now
propagate NULL - the asymmetry is gone there. They're only dual-run for `col.a`
because the single-pass resolver doesn't resolve subscript extraction at all
today (normal `a[0]`/`m['k']` fail under single-pass too;
`ExtractValueResolver` is unwired) - a pre-existing limitation independent of
`NullType`, so the subscript forms run under the legacy analyzer only.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]