Fix named struct dataType null field names [databricks] - #15358
Conversation
Signed-off-by: Firestarman <firestarmanllc@gmail.com>
Greptile SummaryThis PR introduces a version-specific shim (
Confidence Score: 5/5Safe to merge — the change is a targeted, non-execution-path fix to The change is small and well-scoped: a single call-site substitution in No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GpuCreateNamedStruct.dataType"] --> B["CreateNamedStructShims.fieldName(name)"]
B --> C{Spark version?}
C -->|"3.3.0 – 4.1.2\n(legacy shim)"| D["name.toString\n(NPE if name == null)"]
C -->|"4.0.4 / 4.1.3 / 4.2.0\n(SPARK-57736 shim)"| E["if (name == null) null\nelse name.toString"]
D --> F["StructField(name, ...)"]
E --> F
F --> G["StructType(fields)"]
H["GpuCreateNamedStruct.checkInputDataTypes"] --> I["names.contains(null)?"]
I -->|yes| J["TypeCheckFailure\n('Field name should not be null')"]
I -->|no| K["TypeCheckSuccess"]
Reviews (2): Last reviewed commit: "Fix named struct import ordering" | Re-trigger Greptile |
|
build |
Signed-off-by: Firestarman <firestarmanllc@gmail.com>
|
build |
Signed-off-by: Firestarman <firestarmanllc@gmail.com>
gerashegalov
left a comment
There was a problem hiding this comment.
LGTM,
not a blocker but just wondering if it is worth shimming instead of making it version-independently correct. /cc @revans2
|
build |
1 similar comment
|
build |
Good question, i just decided to aligin with the Spark behavior. |
|
I am going to merge this, if we decide to make it version-independently correct, i will file another PR. |
Fixes #15316.
Description
GpuCreateNamedStruct.dataTypeto match Spark behavior for null field names, so Spark versions with SPARK-57736 no longer hit an NPE before type checking rejects the invalid input.CreateNamedStructShimsso legacy Spark shims keep the oldname.toStringbehavior, while Spark 4.0.4, 4.1.3, and 4.2.0 use Spark's null-safe field-name behavior.GpuCreateNamedStruct.dataTypeand the expected input type-check failure.mvn -s /home/liangcail/.m2/settings_art.xml -f scala2.13/pom.xml -pl sql-plugin -Dbuildver=358 -Dcuda.version=cuda13 -DwildcardSuites=org.apache.spark.sql.rapids.GpuCreateNamedStructSuite test, plus the same command forbuildver=403,404,412,413, and420.Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance