Skip to content

Commit

Permalink
[SPARK-16948][SQL] Querying empty partitioned orc tables throws excep…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
rbalamohan committed Sep 22, 2016
1 parent fa71370 commit e39715e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,13 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
partitionSpec)

val schema = fileType match {
case "orc" | "parquet" =>
case "parquet" =>
val inferredSchema =
defaultSource.inferSchema(sparkSession, options, fileCatalog.allFiles())
inferredSchema.map { inferred =>
ParquetFileFormat.mergeMetastoreParquetSchema(metastoreSchema, inferred)
}.getOrElse(metastoreSchema)
case "orc" =>
metastoreSchema
case _ =>
throw new RuntimeException(s"Cannot convert a $fileType to a data source table")
Expand Down

0 comments on commit e39715e

Please sign in to comment.