Search in sources :

Example 1 with CarbonFooterWriter

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

the class CarbonFactDataWriterImplV2 method writeBlockletInfoToFile.

/**
   * This method will write metadata at the end of file file format in thrift format
   */
protected void writeBlockletInfoToFile(FileChannel channel, String filePath) throws CarbonDataWriterException {
    try {
        // get the current file position
        long currentPosition = channel.size();
        CarbonFooterWriter writer = new CarbonFooterWriter(filePath);
        // get thrift file footer instance
        FileFooter convertFileMeta = CarbonMetadataUtil.convertFilterFooter2(blockletInfoList, localCardinality, thriftColumnSchemaList, dataChunksOffsets, dataChunksLength);
        // fill the carbon index details
        fillBlockIndexInfoDetails(convertFileMeta.getNum_rows(), carbonDataFileName, currentPosition);
        // write the footer
        writer.writeFooter(convertFileMeta, currentPosition);
    } catch (IOException e) {
        throw new CarbonDataWriterException("Problem while writing the carbon file: ", e);
    }
}
Also used : FileFooter(org.apache.carbondata.format.FileFooter) IOException(java.io.IOException) CarbonFooterWriter(org.apache.carbondata.core.writer.CarbonFooterWriter) CarbonDataWriterException(org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException)

Example 2 with CarbonFooterWriter

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

the class CarbonFactDataWriterImplV1 method writeBlockletInfoToFile.

/**
   * This method will write metadata at the end of file file format in thrift format
   */
protected void writeBlockletInfoToFile(FileChannel channel, String filePath) throws CarbonDataWriterException {
    try {
        long currentPosition = channel.size();
        CarbonFooterWriter writer = new CarbonFooterWriter(filePath);
        FileFooter convertFileMeta = CarbonMetadataUtil.convertFileFooter(blockletInfoList, localCardinality.length, localCardinality, thriftColumnSchemaList, dataWriterVo.getSegmentProperties());
        fillBlockIndexInfoDetails(convertFileMeta.getNum_rows(), carbonDataFileName, currentPosition);
        writer.writeFooter(convertFileMeta, currentPosition);
    } catch (IOException e) {
        throw new CarbonDataWriterException("Problem while writing the carbon file: ", e);
    }
}
Also used : FileFooter(org.apache.carbondata.format.FileFooter) IOException(java.io.IOException) CarbonFooterWriter(org.apache.carbondata.core.writer.CarbonFooterWriter) CarbonDataWriterException(org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException)

Aggregations

IOException (java.io.IOException)2 CarbonFooterWriter (org.apache.carbondata.core.writer.CarbonFooterWriter)2 FileFooter (org.apache.carbondata.format.FileFooter)2 CarbonDataWriterException (org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException)2