yaooqinn commented on code in PR #50367:
URL: https://github.com/apache/spark/pull/50367#discussion_r2011636879


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala:
##########
@@ -271,7 +271,15 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, 
hadoopConf: Configurat
         ignoreIfExists)
     } else {
       val tableWithDataSourceProps = tableDefinition.copy(
-        schema = hiveCompatibleSchema,
+        schema = hiveCompatibleSchema match {
+          // Spark-created views do not have to be Hive compatible. If the 
data type is not
+          // Hive compatible, we can set schema to empty so that Spark can 
still read this
+          // view as the schema is also encoded in the table properties.
+          case schema if schema.exists(f => 
!isHiveCompatibleDataType(f.dataType)) &&
+              tableDefinition.tableType == CatalogTableType.VIEW =>

Review Comment:
   Switch the order of 2 guardians?



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

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to