Search in sources :

Example 1 with CarbonDeleteDeltaWriterImpl

use of org.apache.carbondata.core.writer.CarbonDeleteDeltaWriterImpl in project carbondata by apache.

the class CarbonDataMergerUtil method startCompactionDeleteDeltaFiles.

/**
   * this method compact the delete delta files.
   * @param deleteDeltaFiles
   * @param blockName
   * @param fullBlockFilePath
   * @return
   */
public static Boolean startCompactionDeleteDeltaFiles(List<String> deleteDeltaFiles, String blockName, String fullBlockFilePath) throws IOException {
    DeleteDeltaBlockDetails deleteDeltaBlockDetails = null;
    CarbonDeleteFilesDataReader dataReader = new CarbonDeleteFilesDataReader();
    try {
        deleteDeltaBlockDetails = dataReader.getCompactedDeleteDeltaFileFromBlock(deleteDeltaFiles, blockName);
    } catch (Exception e) {
        String blockFilePath = fullBlockFilePath.substring(0, fullBlockFilePath.lastIndexOf(CarbonCommonConstants.FILE_SEPARATOR));
        LOGGER.error("Error while getting the delete delta blocks in path " + blockFilePath);
        throw new IOException();
    }
    CarbonDeleteDeltaWriterImpl carbonDeleteWriter = new CarbonDeleteDeltaWriterImpl(fullBlockFilePath, FileFactory.getFileType(fullBlockFilePath));
    try {
        carbonDeleteWriter.write(deleteDeltaBlockDetails);
    } catch (IOException e) {
        LOGGER.error("Error while writing compacted delete delta file " + fullBlockFilePath);
        throw new IOException();
    }
    return true;
}
Also used : CarbonDeleteDeltaWriterImpl(org.apache.carbondata.core.writer.CarbonDeleteDeltaWriterImpl) DeleteDeltaBlockDetails(org.apache.carbondata.core.mutate.DeleteDeltaBlockDetails) IOException(java.io.IOException) CarbonDeleteFilesDataReader(org.apache.carbondata.core.reader.CarbonDeleteFilesDataReader) ParseException(java.text.ParseException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 DeleteDeltaBlockDetails (org.apache.carbondata.core.mutate.DeleteDeltaBlockDetails)1 CarbonDeleteFilesDataReader (org.apache.carbondata.core.reader.CarbonDeleteFilesDataReader)1 CarbonDeleteDeltaWriterImpl (org.apache.carbondata.core.writer.CarbonDeleteDeltaWriterImpl)1