cloud-fan commented on a change in pull request #27110: [SPARK-30439][SQL]
Support NOT NULL in column data type
URL: https://github.com/apache/spark/pull/27110#discussion_r363796155
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -466,6 +466,10 @@ trait CheckAnalysis extends PredicateHelper {
s"${field.dataType.simpleString} cannot be cast to " +
s"${update.newDataType.simpleString}")
}
+ if (!update.isNullable && field.nullable) {
+ throw new AnalysisException(
+ s"Cannot change optional column to required:
${field.name}")
Review comment:
It's a big change if we want to allow unsafe type change (e.g. need data
validation). I'd like to keep the current behavior for now.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]