use of org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk in project carbondata by apache.
the class CarbonUtilTest method IndexUsingBinarySearchLengthTwo.
@Test
public void IndexUsingBinarySearchLengthTwo() {
byte[] dataChunk = new byte[10];
FixedLengthDimensionDataChunk fixedLengthDimensionDataChunk;
byte[] keyWord = new byte[2];
dataChunk = "aabbbbbbbbbbcc".getBytes();
byte[][] dataArr = new byte[dataChunk.length / keyWord.length][keyWord.length];
fixedLengthDimensionDataChunk = new FixedLengthDimensionDataChunk(dataChunk, null, null, dataChunk.length / keyWord.length, keyWord.length);
for (int ii = 0; ii < dataChunk.length / keyWord.length; ii++) {
dataArr[ii] = fixedLengthDimensionDataChunk.getChunkData(ii);
}
keyWord[0] = Byte.valueOf("98");
keyWord[1] = Byte.valueOf("98");
int[] expectRangeIndex = new int[2];
expectRangeIndex[0] = 1;
expectRangeIndex[1] = 5;
assertRangeIndex(dataArr, dataChunk, fixedLengthDimensionDataChunk, keyWord, expectRangeIndex);
keyWord[0] = Byte.valueOf("97");
keyWord[1] = Byte.valueOf("97");
expectRangeIndex = new int[2];
expectRangeIndex[0] = 0;
expectRangeIndex[1] = 0;
assertRangeIndex(dataArr, dataChunk, fixedLengthDimensionDataChunk, keyWord, expectRangeIndex);
keyWord[0] = Byte.valueOf("99");
keyWord[1] = Byte.valueOf("99");
expectRangeIndex = new int[2];
expectRangeIndex[0] = 6;
expectRangeIndex[1] = 6;
assertRangeIndex(dataArr, dataChunk, fixedLengthDimensionDataChunk, keyWord, expectRangeIndex);
}
use of org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk in project carbondata by apache.
the class CarbonUtilTest method IndexUsingBinarySearchLengthThree.
@Test
public void IndexUsingBinarySearchLengthThree() {
byte[] dataChunk = new byte[10];
FixedLengthDimensionDataChunk fixedLengthDimensionDataChunk;
byte[] keyWord = new byte[3];
dataChunk = "aaabbbbbbbbbccc".getBytes();
byte[][] dataArr = new byte[dataChunk.length / keyWord.length][keyWord.length];
fixedLengthDimensionDataChunk = new FixedLengthDimensionDataChunk(dataChunk, null, null, dataChunk.length / keyWord.length, keyWord.length);
for (int ii = 0; ii < dataChunk.length / keyWord.length; ii++) {
dataArr[ii] = fixedLengthDimensionDataChunk.getChunkData(ii);
}
keyWord[0] = Byte.valueOf("98");
keyWord[1] = Byte.valueOf("98");
keyWord[2] = Byte.valueOf("98");
int[] expectRangeIndex = new int[2];
expectRangeIndex[0] = 1;
expectRangeIndex[1] = 3;
assertRangeIndex(dataArr, dataChunk, fixedLengthDimensionDataChunk, keyWord, expectRangeIndex);
}
Aggregations