Skip to content

Commit fa71370

Browse files
committed
[SPARK-16948][SQL] Querying empty partitioned orc tables throws exception
1 parent 9ecb2ed commit fa71370

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,7 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
238238
partitionSpec)
239239

240240
val schema = fileType match {
241-
case "parquet" =>
242-
val inferredSchema =
243-
defaultSource.inferSchema(sparkSession, options, fileCatalog.allFiles())
244-
245-
// For Parquet, get correct schema by merging Metastore schema data types
246-
// and Parquet schema field names.
247-
inferredSchema.map { schema =>
248-
ParquetFileFormat.mergeMetastoreParquetSchema(metastoreSchema, schema)
249-
}.getOrElse(metastoreSchema)
250-
case "orc" =>
241+
case "orc" | "parquet" =>
251242
metastoreSchema
252243
case _ =>
253244
throw new RuntimeException(s"Cannot convert a $fileType to a data source table")

0 commit comments

Comments
 (0)