Search in sources :

Example 16 with FixedLengthDimensionDataChunk

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);
}
Also used : FixedLengthDimensionDataChunk(org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk) Test(org.junit.Test)

Example 17 with FixedLengthDimensionDataChunk

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);
}
Also used : FixedLengthDimensionDataChunk(org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk) Test(org.junit.Test)

Aggregations

FixedLengthDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk)17 Test (org.junit.Test)12 ByteBuffer (java.nio.ByteBuffer)3 BitSet (java.util.BitSet)3 DimensionColumnDataChunk (org.apache.carbondata.core.datastore.chunk.DimensionColumnDataChunk)3 ColumnGroupDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.ColumnGroupDimensionDataChunk)3 VariableLengthDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.VariableLengthDimensionDataChunk)3 DataChunk2 (org.apache.carbondata.format.DataChunk2)2 FileHolder (org.apache.carbondata.core.datastore.FileHolder)1 DataChunk (org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk)1 DataChunk3 (org.apache.carbondata.format.DataChunk3)1