Repository: carbondata
Updated Branches:
  refs/heads/master e2a79eebb -> 3c5d10f39


[CARBONDATA-1869] Null pointer exception thrown when concurrent load and select 
queries executed for table with dictionary exclude or NO_INVERTED_INDEX

While updating the file, we need FileStatus, this FileStatus can be null. So 
before accessing FileStatus, a null check is needed.

This closes #1625


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/3c5d10f3
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/3c5d10f3
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/3c5d10f3

Branch: refs/heads/master
Commit: 3c5d10f399acdd42a563f40c9c153548ee2913f8
Parents: e2a79ee
Author: dhatchayani <[email protected]>
Authored: Wed Dec 6 19:13:27 2017 +0530
Committer: manishgupta88 <[email protected]>
Committed: Tue Dec 12 10:44:35 2017 +0530

----------------------------------------------------------------------
 .../filesystem/AbstractDFSCarbonFile.java       | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/3c5d10f3/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
 
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
index 12466b2..3eb97bc 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/AbstractDFSCarbonFile.java
@@ -138,23 +138,29 @@ public abstract  class AbstractDFSCarbonFile implements 
CarbonFile {
   public boolean renameTo(String changetoName) {
     FileSystem fs;
     try {
-      fs = fileStatus.getPath().getFileSystem(hadoopConf);
-      return fs.rename(fileStatus.getPath(), new Path(changetoName));
+      if (null != fileStatus) {
+        fs = fileStatus.getPath().getFileSystem(hadoopConf);
+        return fs.rename(fileStatus.getPath(), new Path(changetoName));
+      }
     } catch (IOException e) {
       LOGGER.error("Exception occurred:" + e.getMessage());
       return false;
     }
+    return false;
   }
 
   public boolean delete() {
     FileSystem fs;
     try {
-      fs = fileStatus.getPath().getFileSystem(hadoopConf);
-      return fs.delete(fileStatus.getPath(), true);
+      if (null != fileStatus) {
+        fs = fileStatus.getPath().getFileSystem(hadoopConf);
+        return fs.delete(fileStatus.getPath(), true);
+      }
     } catch (IOException e) {
       LOGGER.error("Exception occurred:" + e.getMessage());
       return false;
     }
+    return false;
   }
 
   @Override public long getLastModifiedTime() {
@@ -164,8 +170,10 @@ public abstract  class AbstractDFSCarbonFile implements 
CarbonFile {
   @Override public boolean setLastModifiedTime(long timestamp) {
     FileSystem fs;
     try {
-      fs = fileStatus.getPath().getFileSystem(hadoopConf);
-      fs.setTimes(fileStatus.getPath(), timestamp, timestamp);
+      if (null != fileStatus) {
+        fs = fileStatus.getPath().getFileSystem(hadoopConf);
+        fs.setTimes(fileStatus.getPath(), timestamp, timestamp);
+      }
     } catch (IOException e) {
       return false;
     }

Reply via email to