We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6cbde33 commit fd37123Copy full SHA for fd37123
sql/hive/src/main/scala/org/apache/spark/sql/hive/MetastoreRelation.scala
@@ -162,7 +162,13 @@ private[hive] case class MetastoreRelation(
162
163
val sd = new org.apache.hadoop.hive.metastore.api.StorageDescriptor()
164
tPartition.setSd(sd)
165
- sd.setCols(catalogTable.schema.map(toHiveColumn).asJava)
+
166
+ // Note: In Hive the schema and partition columns must be disjoint sets
167
+ val schema = catalogTable.schema.map(toHiveColumn).filter { c =>
168
+ !catalogTable.partitionColumnNames.contains(c.getName)
169
+ }
170
+ sd.setCols(schema.asJava)
171
172
p.storage.locationUri.foreach(sd.setLocation)
173
p.storage.inputFormat.foreach(sd.setInputFormat)
174
p.storage.outputFormat.foreach(sd.setOutputFormat)
0 commit comments