use of org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class UnsafeIntermediateFileMerger method initialize.
/**
* This method is responsible for initializing the out stream
*
* @throws CarbonSortKeyAndGroupByException
*/
private void initialize() throws CarbonSortKeyAndGroupByException {
if (!mergerParameters.isSortFileCompressionEnabled() && !mergerParameters.isPrefetch()) {
try {
this.stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(outPutFile), mergerParameters.getFileWriteBufferSize()));
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);
}
} else {
writer = TempSortFileWriterFactory.getInstance().getTempSortFileWriter(mergerParameters.isSortFileCompressionEnabled(), mergerParameters.getDimColCount(), mergerParameters.getComplexDimColCount(), mergerParameters.getMeasureColCount(), mergerParameters.getNoDictionaryCount(), mergerParameters.getFileWriteBufferSize());
writer.initiaize(outPutFile, totalNumberOfRecords);
}
}
use of org.apache.carbondata.processing.sortandgroupby.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 {
if (!mergerParameters.isSortFileCompressionEnabled() && !mergerParameters.isPrefetch()) {
try {
this.stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(outPutFile), mergerParameters.getFileWriteBufferSize()));
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);
}
} else {
writer = TempSortFileWriterFactory.getInstance().getTempSortFileWriter(mergerParameters.isSortFileCompressionEnabled(), mergerParameters.getDimColCount(), mergerParameters.getComplexDimColCount(), mergerParameters.getMeasureColCount(), mergerParameters.getNoDictionaryCount(), mergerParameters.getFileWriteBufferSize());
writer.initiaize(outPutFile, totalNumberOfRecords);
if (mergerParameters.isPrefetch()) {
totalSize = mergerParameters.getBufferSize();
} else {
totalSize = mergerParameters.getSortTempFileNoOFRecordsInCompression();
}
}
}
use of org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class SortDataRows method startFileBasedMerge.
/**
* Below method will be used to start file based merge
*
* @throws CarbonSortKeyAndGroupByException
*/
private void startFileBasedMerge() throws CarbonSortKeyAndGroupByException {
try {
dataSorterAndWriterExecutorService.shutdown();
dataSorterAndWriterExecutorService.awaitTermination(2, TimeUnit.DAYS);
} catch (InterruptedException e) {
throw new CarbonSortKeyAndGroupByException("Problem while shutdown the server ", e);
}
}
use of org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class AbstractTempSortFileWriter method initiaize.
/**
* Below method will be used to initialize the stream and write the entry count
*/
@Override
public void initiaize(File file, int entryCount) throws CarbonSortKeyAndGroupByException {
try {
stream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file), writeBufferSize));
stream.writeInt(entryCount);
} catch (FileNotFoundException e1) {
throw new CarbonSortKeyAndGroupByException(e1);
} catch (IOException e) {
throw new CarbonSortKeyAndGroupByException(e);
}
}
use of org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException in project carbondata by apache.
the class UnsafeSortDataRows method getMemoryBlock.
public static MemoryBlock getMemoryBlock(long size) throws CarbonSortKeyAndGroupByException {
MemoryBlock baseBlock = null;
int tries = 0;
while (true && tries < 100) {
baseBlock = UnsafeMemoryManager.INSTANCE.allocateMemory(size);
if (baseBlock == null) {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
throw new CarbonSortKeyAndGroupByException(e);
}
} else {
break;
}
tries++;
}
if (baseBlock == null) {
throw new CarbonSortKeyAndGroupByException("Not enough memory to create page");
}
return baseBlock;
}
Aggregations