use of org.apache.carbondata.processing.loading.row.IntermediateSortTempRow in project carbondata by apache.
the class IntermediateSortTempRowComparatorTest method comparemixed.
@Test
public void comparemixed() {
DataType[] noDicDataTypes = { DataTypes.BOOLEAN, DataTypes.INT, DataTypes.LONG };
boolean[] noDicSortColumnMapping = { true };
new_comparator = new IntermediateSortTempRowComparator(noDicSortColumnMapping, noDicDataTypes);
int[] dictSortDims1 = { 1, 2, 3 };
Object[] noDictSortDims1 = { true, 1, 2L };
byte[] noSortDimsAndMeasures1 = { 1, 2, 3 };
IntermediateSortTempRow a1 = new IntermediateSortTempRow(dictSortDims1, noDictSortDims1, noSortDimsAndMeasures1);
int[] dictSortDims = { 1, 2, 3 };
Object[] noDictSortDims = { false, 3, 5L };
byte[] noSortDimsAndMeasures = { 1, 2, 3 };
IntermediateSortTempRow a = new IntermediateSortTempRow(dictSortDims, noDictSortDims, noSortDimsAndMeasures);
int res = new_comparator.compare(a1, a);
Assert.assertTrue(res > 0);
}
use of org.apache.carbondata.processing.loading.row.IntermediateSortTempRow in project carbondata by apache.
the class IntermediateSortTempRowComparatorTest method compareint.
@Test
public void compareint() {
DataType[] noDicDataTypes = { DataTypes.INT };
boolean[] noDicSortColumnMapping = { true };
new_comparator = new IntermediateSortTempRowComparator(noDicSortColumnMapping, noDicDataTypes);
int[] dictSortDims1 = { 1, 2, 3 };
Object[] noDictSortDims1 = { 1, 2, 3 };
byte[] noSortDimsAndMeasures1 = { 1, 2, 3 };
IntermediateSortTempRow a1 = new IntermediateSortTempRow(dictSortDims1, noDictSortDims1, noSortDimsAndMeasures1);
int[] dictSortDims = { 1, 2, 3 };
Object[] noDictSortDims = { 4, 5, 6 };
byte[] noSortDimsAndMeasures = { 1, 2, 3 };
IntermediateSortTempRow a = new IntermediateSortTempRow(dictSortDims, noDictSortDims, noSortDimsAndMeasures);
int res = new_comparator.compare(a, a1);
Assert.assertTrue(res > 0);
}
use of org.apache.carbondata.processing.loading.row.IntermediateSortTempRow in project carbondata by apache.
the class UnsafeCarbonRowPage method getRow.
/**
* get one row from memory address
* @param address address
* @return one row
*/
public IntermediateSortTempRow getRow(long address) {
if (convertNoSortFields) {
IntermediateSortTempRow intermediateSortTempRow = sortStepRowHandler.readRowFromMemoryWithNoSortFieldConvert(dataBlock.getBaseObject(), address);
this.sortTempRowUpdater.updateSortTempRow(intermediateSortTempRow);
return intermediateSortTempRow;
} else {
return sortStepRowHandler.readFromMemoryWithoutNoSortFieldConvert(dataBlock.getBaseObject(), address);
}
}
use of org.apache.carbondata.processing.loading.row.IntermediateSortTempRow in project carbondata by apache.
the class UnsafeSortTempFileChunkHolder method readBatchedRowFromStream.
/**
* get a batch of row, this interface is used in reading compressed sort temp files
*
* @param expected expected number in a batch
* @return a batch of row
* @throws IOException if error occurs while reading from stream
*/
private IntermediateSortTempRow[] readBatchedRowFromStream(int expected) throws IOException {
IntermediateSortTempRow[] holders = new IntermediateSortTempRow[expected];
for (int i = 0; i < expected; i++) {
if (convertNoSortFields) {
IntermediateSortTempRow intermediateSortTempRow = sortStepRowHandler.readWithNoSortFieldConvert(stream);
sortTempRowUpdater.updateSortTempRow(intermediateSortTempRow);
holders[i] = intermediateSortTempRow;
} else {
holders[i] = sortStepRowHandler.readWithoutNoSortFieldConvert(stream);
}
}
this.numberOfObjectRead += expected;
return holders;
}
use of org.apache.carbondata.processing.loading.row.IntermediateSortTempRow in project carbondata by apache.
the class UnsafeSortTempFileChunkHolder method readRow.
/**
* This method will be used to read new row from file
*
* @throws CarbonSortKeyAndGroupByException problem while reading
*/
@Override
public void readRow() throws CarbonSortKeyAndGroupByException {
if (prefetch) {
fillDataForPrefetch();
} else {
try {
if (convertNoSortFields) {
IntermediateSortTempRow intermediateSortTempRow = sortStepRowHandler.readWithNoSortFieldConvert(stream);
sortTempRowUpdater.updateSortTempRow(intermediateSortTempRow);
this.returnRow = intermediateSortTempRow;
} else {
this.returnRow = sortStepRowHandler.readWithoutNoSortFieldConvert(stream);
}
this.numberOfObjectRead++;
} catch (IOException e) {
throw new CarbonSortKeyAndGroupByException("Problems while reading row", e);
}
}
}
Aggregations