-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-4293][SQL] Make Cast be able to handle complex types. #3150
Conversation
…th nullability is false into Hive table.
Test build #23041 has started for PR 3150 at commit
|
Test build #23041 has finished for PR 3150 at commit
|
Test PASSed. |
toField.nullable) | ||
} | ||
|
||
case _ => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if throwing exception will be more informative, than plain UnresolvedException
thrown in logical plan analyzing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think the resolve check should be in logical plan analyzing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some expressions are checking the resolved
in the dataType
method, though.
It looks good to me in general, and I like the idea of summarizing the convertible data type checking, but in the meantime, I am a little afraid it might be error-prone for future maintenance or new data type added. |
@chenghao-intel, Thank you for your comments. |
Conflicts: sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertIntoHiveTableSuite.scala
Test build #23081 has started for PR 3150 at commit
|
Test build #23081 has finished for PR 3150 at commit
|
Test PASSed. |
Test build #23096 has started for PR 3150 at commit
|
Test build #23096 has finished for PR 3150 at commit
|
Test PASSed. |
Conflicts: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
Test build #23408 has started for PR 3150 at commit
|
Test build #23408 has finished for PR 3150 at commit
|
Test PASSed. |
Conflicts: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
Test build #23899 has started for PR 3150 at commit
|
Test build #23899 has finished for PR 3150 at commit
|
Test PASSed. |
Sorry for the delay and thanks for working on this! Merging to master. |
Actually, apache is down :( LGTM, will merge later. |
Inserting data of type including
ArrayType.containsNull == false
orMapType.valueContainsNull == false
orStructType.fields.exists(_.nullable == false)
into Hive table will fail becauseCast
inserted byHiveMetastoreCatalog.PreInsertionCasts
rule ofAnalyzer
can't handle these types correctly.Complex type cast rule proposal:
ArrayType
can evaluate ifMapType
can evaluate iffalse
StructType
can evaluate ifNullability rule:
nullable == true
, the target nullability should betrue