Skip to content

Commit 258d000

Browse files
committed
really really correct path handling
1 parent e56fd4a commit 258d000

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,14 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
188188
hiveMetastoreJars
189189
.split(File.pathSeparator)
190190
.flatMap {
191-
case path if path.endsWith("*") =>
192-
val directory = new File(path.dropRight(1))
193-
directory.listFiles.filter(_.getName.endsWith("jar"))
191+
case path if new File(path).getName() == "*" =>
192+
val files = new File(path).getParentFile().listFiles()
193+
if (files == null) {
194+
logWarning(s"Hive jar path '$path' does not exist.")
195+
Nil
196+
} else {
197+
files.filter(_.getName().toLowerCase().endsWith(".jar"))
198+
}
194199
case path =>
195200
new File(path) :: Nil
196201
}

0 commit comments

Comments
 (0)