Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/16606#discussion_r97464241
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
---
@@ -186,12 +186,13 @@ case class CatalogTable(
/**
* schema of this table's partition columns
*/
- def partitionSchema: StructType = StructType(partitionColumnNames.map {
- p => schema.find(_.name == p).getOrElse(
- throw new AnalysisException(s"Partition column [$p] " +
- s"did not exist in schema ${schema.toString}")
- )
- })
+ def partitionSchema: StructType = {
+ assert(schema.takeRight(partitionColumnNames.length).map(_.name) ==
partitionColumnNames)
+
+ StructType(schema.filter { c =>
+ partitionColumnNames.contains(c.name)
+ })
--- End diff --
This can be shorten to a single line.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]