You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/07 05:22:38 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #30586: [SPARK-33641][SQL] Invalidate new char/varchar types in public APIs that produce incorrect results
cloud-fan commented on a change in pull request #30586:
URL: https://github.com/apache/spark/pull/30586#discussion_r537238737
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/CharVarcharUtils.scala
##########
@@ -52,6 +55,17 @@ object CharVarcharUtils {
dt.existsRecursively(f => f.isInstanceOf[CharType] || f.isInstanceOf[VarcharType])
}
+ /**
+ * Validate the given [[DataType]] to fail if it is char or varchar types or contains nested ones
+ */
+ def failIfHasCharVarchar(dt: DataType): DataType = {
+ if (!SQLConf.get.charVarcharAsString && hasCharVarchar(dt)) {
+ throw new AnalysisException("char/varchar type can only be used in the table schema")
Review comment:
can we mention the config name?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org