Search in sources :

Example 1 with CarbonIndexFileMergeWriter

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

the class MapredCarbonOutputCommitter method commitJob.

@Override
public void commitJob(JobContext jobContext) throws IOException {
    try {
        Configuration configuration = jobContext.getConfiguration();
        CarbonLoadModel carbonLoadModel = MapredCarbonOutputFormat.getLoadModel(configuration);
        ThreadLocalSessionInfo.unsetAll();
        CarbonTable carbonTable = carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable();
        new CarbonIndexFileMergeWriter(carbonTable).mergeCarbonIndexFilesOfSegment(carbonLoadModel.getSegmentId(), carbonTable.getTablePath(), false, String.valueOf(carbonLoadModel.getFactTimeStamp()));
        SegmentFileStore.writeSegmentFile(carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable(), carbonLoadModel.getSegmentId(), String.valueOf(carbonLoadModel.getFactTimeStamp()));
        CarbonTableOutputFormat.setLoadModel(configuration, carbonLoadModel);
        carbonOutputCommitter.commitJob(jobContext);
    } catch (Exception e) {
        LOGGER.error(e);
        throw e;
    }
}
Also used : CarbonTable(org.apache.carbondata.core.metadata.schema.table.CarbonTable) CarbonIndexFileMergeWriter(org.apache.carbondata.core.writer.CarbonIndexFileMergeWriter) Configuration(org.apache.hadoop.conf.Configuration) CarbonLoadModel(org.apache.carbondata.processing.loading.model.CarbonLoadModel) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 CarbonTable (org.apache.carbondata.core.metadata.schema.table.CarbonTable)1 CarbonIndexFileMergeWriter (org.apache.carbondata.core.writer.CarbonIndexFileMergeWriter)1 CarbonLoadModel (org.apache.carbondata.processing.loading.model.CarbonLoadModel)1 Configuration (org.apache.hadoop.conf.Configuration)1