carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [4/6] incubator-carbondata git commit: Rename fileName to carbonDataFileTempPath.
Date Mon, 27 Mar 2017 14:57:42 GMT
Rename fileName to carbonDataFileTempPath.


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

Branch: refs/heads/master
Commit: d17f58f18ede87aef53e92973bd6e319fa2e31ad
Parents: 84477cc
Author: Yadong Qi <qiyadong2010@gmail.com>
Authored: Mon Mar 27 18:48:31 2017 +0800
Committer: Yadong Qi <qiyadong2010@gmail.com>
Committed: Mon Mar 27 18:48:31 2017 +0800

----------------------------------------------------------------------
 .../processing/mdkeygen/file/FileData.java      |  2 +-
 .../store/writer/AbstractFactDataWriter.java    | 27 +++++++++++---------
 .../writer/v3/CarbonFactDataWriterImplV3.java   |  4 +--
 3 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/d17f58f1/processing/src/main/java/org/apache/carbondata/processing/mdkeygen/file/FileData.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/mdkeygen/file/FileData.java
b/processing/src/main/java/org/apache/carbondata/processing/mdkeygen/file/FileData.java
index 340a2ab..024a0b9 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/mdkeygen/file/FileData.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/mdkeygen/file/FileData.java
@@ -37,7 +37,7 @@ public class FileData extends FileManager {
   }
 
   /**
-   * @return Returns the fileName.
+   * @return Returns the carbonDataFileTempPath.
    */
   public String getFileName() {
     return fileName;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/d17f58f1/processing/src/main/java/org/apache/carbondata/processing/store/writer/AbstractFactDataWriter.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/store/writer/AbstractFactDataWriter.java
b/processing/src/main/java/org/apache/carbondata/processing/store/writer/AbstractFactDataWriter.java
index a7dc534..90eab6f 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/store/writer/AbstractFactDataWriter.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/store/writer/AbstractFactDataWriter.java
@@ -95,9 +95,9 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
   protected List<BlockletInfoColumnar> blockletInfoList;
   protected boolean[] isNoDictionary;
   /**
-   * file name
+   * The temp path of carbonData file used on executor
    */
-  protected String fileName;
+  protected String carbonDataFileTempPath;
 
   /**
    * The name of carbonData file
@@ -261,10 +261,10 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
   protected void updateBlockletFileChannel(long blockletDataSize) throws CarbonDataWriterException
{
     if ((currentFileSize + blockletDataSize) >= dataBlockSize && currentFileSize
!= 0) {
       // set the current file size to zero
-      LOGGER.info("Writing data to file as max file size reached for file: " + fileName
+      LOGGER.info("Writing data to file as max file size reached for file: " + carbonDataFileTempPath
           + " .Data block size: " + currentFileSize);
       // write meta data to end of the existing file
-      writeBlockletInfoToFile(fileChannel, fileName);
+      writeBlockletInfoToFile(fileChannel, carbonDataFileTempPath);
       this.currentFileSize = 0;
       blockletInfoList =
           new ArrayList<BlockletInfoColumnar>(CarbonCommonConstants.CONSTANT_SIZE_TEN);
@@ -276,7 +276,8 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
       // rename carbon data file from in progress status to actual
       renameCarbonDataFile();
       executorServiceSubmitList.add(executorService
-          .submit(new CopyThread(this.fileName.substring(0, this.fileName.lastIndexOf('.')))));
+          .submit(new CopyThread(this.carbonDataFileTempPath
+              .substring(0, this.carbonDataFileTempPath.lastIndexOf('.')))));
       // initialize the new channel
       initializeWriter();
     }
@@ -299,12 +300,12 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
     String actualFileNameVal = carbonDataFileName + CarbonCommonConstants.FILE_INPROGRESS_STATUS;
     FileData fileData = new FileData(actualFileNameVal, dataWriterVo.getStoreLocation());
     dataWriterVo.getFileManager().add(fileData);
-    this.fileName = dataWriterVo.getStoreLocation() + File.separator + carbonDataFileName
-        + CarbonCommonConstants.FILE_INPROGRESS_STATUS;
+    this.carbonDataFileTempPath = dataWriterVo.getStoreLocation() + File.separator
+        + carbonDataFileName + CarbonCommonConstants.FILE_INPROGRESS_STATUS;
     this.fileCount++;
     try {
       // open channel for new data file
-      fileOutputStream = new FileOutputStream(this.fileName, true);
+      fileOutputStream = new FileOutputStream(this.carbonDataFileTempPath, true);
       this.fileChannel = fileOutputStream.getChannel();
     } catch (FileNotFoundException fileNotFoundException) {
       throw new CarbonDataWriterException("Problem while getting the FileChannel for Leaf
File",
@@ -420,7 +421,8 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
     if (this.blockletInfoList.size() > 0) {
       renameCarbonDataFile();
       copyCarbonDataFileToCarbonStorePath(
-          this.fileName.substring(0, this.fileName.lastIndexOf('.')));
+          this.carbonDataFileTempPath
+              .substring(0, this.carbonDataFileTempPath.lastIndexOf('.')));
       try {
         writeIndexFile();
       } catch (IOException e) {
@@ -490,8 +492,9 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
    * @throws CarbonDataWriterException
    */
   protected void renameCarbonDataFile() throws CarbonDataWriterException {
-    File origFile = new File(this.fileName.substring(0, this.fileName.lastIndexOf('.')));
-    File curFile = new File(this.fileName);
+    File origFile = new File(this.carbonDataFileTempPath
+        .substring(0, this.carbonDataFileTempPath.lastIndexOf('.')));
+    File curFile = new File(this.carbonDataFileTempPath);
     if (!curFile.renameTo(origFile)) {
       throw new CarbonDataWriterException("Problem while renaming the file");
     }
@@ -559,7 +562,7 @@ public abstract class AbstractFactDataWriter<T> implements CarbonFactDataWriter<
    */
   @Override public void writeBlockletInfoToFile() throws CarbonDataWriterException {
     if (this.blockletInfoList.size() > 0) {
-      writeBlockletInfoToFile(fileChannel, fileName);
+      writeBlockletInfoToFile(fileChannel, carbonDataFileTempPath);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/d17f58f1/processing/src/main/java/org/apache/carbondata/processing/store/writer/v3/CarbonFactDataWriterImplV3.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/store/writer/v3/CarbonFactDataWriterImplV3.java
b/processing/src/main/java/org/apache/carbondata/processing/store/writer/v3/CarbonFactDataWriterImplV3.java
index 668d0d8..3b7c763 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/store/writer/v3/CarbonFactDataWriterImplV3.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/store/writer/v3/CarbonFactDataWriterImplV3.java
@@ -540,11 +540,11 @@ public class CarbonFactDataWriterImplV3 extends AbstractFactDataWriter<short[]>
   public void closeWriter() throws CarbonDataWriterException {
     if (dataWriterHolder.getNodeHolder().size() > 0) {
       writeDataToFile(fileChannel);
-      writeBlockletInfoToFile(fileChannel, fileName);
+      writeBlockletInfoToFile(fileChannel, carbonDataFileTempPath);
       CarbonUtil.closeStreams(this.fileOutputStream, this.fileChannel);
       renameCarbonDataFile();
       copyCarbonDataFileToCarbonStorePath(
-          this.fileName.substring(0, this.fileName.lastIndexOf('.')));
+          this.carbonDataFileTempPath.substring(0, this.carbonDataFileTempPath.lastIndexOf('.')));
       try {
         writeIndexFile();
       } catch (IOException e) {


Mime
View raw message