You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ra...@apache.org on 2017/01/20 17:39:36 UTC
[28/50] [abbrv] incubator-carbondata git commit: Fixed
ALL_DICTIONARY_PATH null pointer exception issue.
Fixed ALL_DICTIONARY_PATH null pointer exception issue.
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/1f0535f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/1f0535f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/1f0535f2
Branch: refs/heads/branch-1.0
Commit: 1f0535f2a66c39686e5a2bfa31d67be6d2009ce8
Parents: af30254
Author: Manohar <ma...@gmail.com>
Authored: Thu Jan 19 12:51:45 2017 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Fri Jan 20 16:15:58 2017 +0530
----------------------------------------------------------------------
.../spark/util/GlobalDictionaryUtil.scala | 21 +++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/1f0535f2/integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala b/integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
index 867a374..09c049d 100644
--- a/integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
+++ b/integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
@@ -28,6 +28,7 @@ import scala.util.control.Breaks.{break, breakable}
import org.apache.commons.lang3.{ArrayUtils, StringUtils}
import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.fs.Path
import org.apache.hadoop.io.NullWritable
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat
import org.apache.spark.Accumulator
@@ -648,12 +649,14 @@ object GlobalDictionaryUtil {
*/
private def validateAllDictionaryPath(allDictionaryPath: String): Boolean = {
val fileType = FileFactory.getFileType(allDictionaryPath)
- val filePath = FileFactory.getCarbonFile(allDictionaryPath, fileType)
+ val filePath = new Path(allDictionaryPath)
+ val file = FileFactory.getCarbonFile(filePath.toString, fileType)
+ val parentFile = FileFactory.getCarbonFile(filePath.getParent.toString, fileType)
// filepath regex, look like "/path/*.dictionary"
if (filePath.getName.startsWith("*")) {
val dictExt = filePath.getName.substring(1)
- if (filePath.getParentFile.exists()) {
- val listFiles = filePath.getParentFile.listFiles()
+ if (parentFile.exists()) {
+ val listFiles = parentFile.listFiles()
if (listFiles.exists(file =>
file.getName.endsWith(dictExt) && file.getSize > 0)) {
true
@@ -663,12 +666,12 @@ object GlobalDictionaryUtil {
false
}
} else {
- throw new FileNotFoundException(
- "The given dictionary file path is not found!")
+ throw new DataLoadingException(
+ s"The given dictionary file path is not found : $allDictionaryPath")
}
} else {
- if (filePath.exists()) {
- if (filePath.getSize > 0) {
+ if (file.exists()) {
+ if (file.getSize > 0) {
true
} else {
LOGGER.warn("No dictionary files found or empty dictionary files! " +
@@ -676,8 +679,8 @@ object GlobalDictionaryUtil {
false
}
} else {
- throw new FileNotFoundException(
- "The given dictionary file path is not found!")
+ throw new DataLoadingException(
+ s"The given dictionary file path is not found : $allDictionaryPath")
}
}
}