cloud-fan commented on a change in pull request #30586:
URL: https://github.com/apache/spark/pull/30586#discussion_r535889970



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/CharVarcharUtils.scala
##########
@@ -52,6 +54,15 @@ 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): Unit = {
+    if (hasCharVarchar(dt)) {
+      throw new AnalysisException(s"Cannot use char/varchar type in this 
caller")

Review comment:
       nit: `char/varchar type can only be used in table schema.`

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/CharVarcharUtils.scala
##########
@@ -52,6 +54,15 @@ 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): Unit = {
+    if (hasCharVarchar(dt)) {
+      throw new AnalysisException(s"Cannot use char/varchar type in this 
caller")

Review comment:
       nit: `char/varchar type can only be used in the table schema.`




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to