From 0eb648cb981d5e2c8bb988d4d1948e8199cdba90 Mon Sep 17 00:00:00 2001 From: ouyangxiaochen Date: Thu, 26 Jul 2018 17:10:24 +0800 Subject: [PATCH] Improve exception information when using LOAD DATA LOCAL INPATH --- .../org/apache/spark/sql/execution/command/tables.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index 56f48b7dc00ee..19ccba46b50fa 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -337,7 +337,11 @@ case class LoadDataCommand( new File(file.getAbsolutePath).exists() } if (!exists) { - throw new AnalysisException(s"LOAD DATA input path does not exist: $path") + // If user have no permission to access the given input path, `File.exists()` return false + // , `LOAD DATA input path does not exist` can confuse users. + throw new AnalysisException(s"LOAD DATA input path does not exist: `$path` or current " + + s"user ${Utils.getCurrentUserName()} have no permission to access the input path: " + + s"`$path`, please check it.") } uri } else {