LantaoJin commented on a change in pull request #26499: [SPARK-29869][SQL] Fix
assertion error in HiveMetastoreCatalog#convertToLogicalRelation
URL: https://github.com/apache/spark/pull/26499#discussion_r346654906
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
##########
@@ -245,20 +245,29 @@ private[hive] class HiveMetastoreCatalog(sparkSession:
SparkSession) extends Log
userSpecifiedSchema = Option(updatedTable.dataSchema),
bucketSpec = None,
options = options,
- className = fileType).resolveRelation(),
+ className = fileType).resolveRelation(needPartitionInferring =
false),
table = updatedTable)
Review comment:
Do you mean trimmed here like this?
```scala
val updatedTable = inferIfNeeded(relation, options, fileFormat)
val baseRelation = DataSource(
sparkSession = sparkSession,
paths = rootPath.toString :: Nil,
userSpecifiedSchema = Option(updatedTable.dataSchema),
bucketSpec = None,
options = options,
className = fileType).resolveRelation()
// filter out the inferred partition col
val trimmedOutput = StructType(baseRelation.schema.filter { field
=>
updatedTable.schema.names.contains(field.name)
}).toAttributes
val created = LogicalRelation(baseRelation, trimmedOutput, table =
updatedTable)
```
But `baseRelation`.schema is still contains partition field.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]