use of org.apache.carbondata.processing.sort.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class UnsafeSortDataRows method addBatch.
private void addBatch(Object[][] rowBatch, int size) throws CarbonSortKeyAndGroupByException {
for (int i = 0; i < size; i++) {
if (rowPage.canAdd()) {
bytesAdded += rowPage.addRow(rowBatch[i], rowBuffer.get());
} else {
try {
if (enableInMemoryIntermediateMerge) {
unsafeInMemoryIntermediateFileMerger.startInmemoryMergingIfPossible();
}
unsafeInMemoryIntermediateFileMerger.startFileMergingIfPossible();
semaphore.acquire();
dataSorterAndWriterExecutorService.execute(new DataSorterAndWriter(rowPage));
rowPage = createUnsafeRowPage();
bytesAdded += rowPage.addRow(rowBatch[i], rowBuffer.get());
} catch (Exception e) {
LOGGER.error("exception occurred while trying to acquire a semaphore lock: " + e.getMessage());
throw new CarbonSortKeyAndGroupByException(e);
}
}
}
}
use of org.apache.carbondata.processing.sort.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class UnsafeSortDataRows method addRow.
/**
* This method will be used to add new row
*/
public void addRow(Object[] row) throws CarbonSortKeyAndGroupByException {
// sort the list and then write current list data to file
if (rowPage.canAdd()) {
rowPage.addRow(row, rowBuffer.get());
} else {
try {
if (enableInMemoryIntermediateMerge) {
unsafeInMemoryIntermediateFileMerger.startInmemoryMergingIfPossible();
}
unsafeInMemoryIntermediateFileMerger.startFileMergingIfPossible();
semaphore.acquire();
dataSorterAndWriterExecutorService.submit(new DataSorterAndWriter(rowPage));
rowPage = createUnsafeRowPage();
rowPage.addRow(row, rowBuffer.get());
} catch (Exception e) {
LOGGER.error("exception occurred while trying to acquire a semaphore lock: " + e.getMessage());
throw new CarbonSortKeyAndGroupByException(e);
}
}
}
use of org.apache.carbondata.processing.sort.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class IntermediateFileMerger method initialize.
/**
* This method is responsible for initializing the out stream
*
* @throws CarbonSortKeyAndGroupByException
*/
private void initialize() throws CarbonSortKeyAndGroupByException {
try {
stream = FileFactory.getDataOutputStream(outPutFile.getPath(), FileFactory.FileType.LOCAL, writeBufferSize, compressorName);
this.stream.writeInt(this.totalNumberOfRecords);
} catch (FileNotFoundException e) {
throw new CarbonSortKeyAndGroupByException("Problem while getting the file", e);
} catch (IOException e) {
throw new CarbonSortKeyAndGroupByException("Problem while writing the data to file", e);
}
}
Aggregations