itholic commented on PR #39804:
URL: https://github.com/apache/spark/pull/39804#issuecomment-1408537902
We could also add `NOT_NULL_CONSTRAINT_VIOLATION.STRUCT_FIELD` for
non-nullable StructField, but this case now it's buried under
`DATATYPE_MISMATCH.CAST_WITHOUT_SUGGESTION` as below:
```sql
spark-sql> SELECT CAST(named_struct('a', null) AS STRUCT<a int not null>);
[DATATYPE_MISMATCH.CAST_WITHOUT_SUGGESTION] Cannot resolve "named_struct(a,
NULL)" due to data type mismatch: cannot cast "STRUCT<a: VOID>" to "STRUCT<a:
INT>".; line 1 pos 7;
'Project [unresolvedalias(cast(named_struct(a, null) as struct<a:int>),
None)]
```
Let me migrate this case in separate ticket to facilitate review since the
change would requires a non-trivial amount of code modifications.
--
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]