cloud-fan commented on code in PR #37364:
URL: https://github.com/apache/spark/pull/37364#discussion_r935010178
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala:
##########
@@ -283,7 +283,22 @@ private[spark] class HiveExternalCatalog(conf: SparkConf,
hadoopConf: Configurat
// columns etc. in table properties, so that we can work around the
Hive metastore issue
// about not case preserving and make Hive serde table and view
support mixed-case column
// names.
- properties = tableDefinition.properties ++
tableMetaToTableProps(tableDefinition))
+ properties = tableDefinition.properties ++
tableMetaToTableProps(tableDefinition)
+ )
+ try {
+ client.createTable(tableWithDataSourceProps, ignoreIfExists)
+ } catch {
+ case NonFatal(e) =>
+ // If for some reason we fail to store the schema we store it as
empty there
+ // since we already store the real schema in the table properties.
This try-catch
+ // should only be necessary for Spark views which are incompatible
with Hive
+ client.createTable(
+ tableWithDataSourceProps.copy(
+ schema = StructType(EMPTY_DATA_SCHEMA ++
tableDefinition.partitionSchema)
Review Comment:
A view cannot have partition columns, so here can simply be `new
StructType()`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]