cloud-fan commented on a change in pull request #30586:
URL: https://github.com/apache/spark/pull/30586#discussion_r535420498
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/CharVarcharUtils.scala
##########
@@ -45,6 +47,41 @@ object CharVarcharUtils {
})
}
+ /**
+ * Validate the given schema to fail if it contains char or varchar types
+ *
+ * @param schema the given struct type
+ * @return
+ */
+ def failWithCharLikeTypes(schema: StructType): StructType = {
+ if (schema.exists(f => hasCharVarchar(f.dataType) ||
+ f.metadata.contains(CHAR_VARCHAR_TYPE_STRING_METADATA_KEY))) {
Review comment:
We can assume that users won't set the very internal
`__CHAR_VARCHAR_TYPE_STRING` metadata key, and only check with the explicit
char/varchar type.
----------------------------------------------------------------
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]