From 258d0002c1795c9c8e69c0a7393eb1a3c81ba411 Mon Sep 17 00:00:00 2001 From: Michael Armbrust Date: Thu, 7 May 2015 23:59:00 +0000 Subject: [PATCH] really really correct path handling --- .../scala/org/apache/spark/sql/hive/HiveContext.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala index 67b78eb6dc2cf..538c6c7f0a200 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala @@ -188,9 +188,14 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) { hiveMetastoreJars .split(File.pathSeparator) .flatMap { - case path if path.endsWith("*") => - val directory = new File(path.dropRight(1)) - directory.listFiles.filter(_.getName.endsWith("jar")) + case path if new File(path).getName() == "*" => + val files = new File(path).getParentFile().listFiles() + if (files == null) { + logWarning(s"Hive jar path '$path' does not exist.") + Nil + } else { + files.filter(_.getName().toLowerCase().endsWith(".jar")) + } case path => new File(path) :: Nil }