Search in sources :

Example 6 with VariableWidthBlock

use of io.trino.spi.block.VariableWidthBlock in project trino by trinodb.

the class SliceDictionaryColumnReader method setDictionaryBlockData.

private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffsets, int positionCount) {
    verify(positionCount > 0);
    // the engine currently uses identity equality to test if dictionaries are the same
    if (currentDictionaryData != dictionaryData) {
        boolean[] isNullVector = new boolean[positionCount];
        isNullVector[positionCount - 1] = true;
        dictionaryOffsets[positionCount] = dictionaryOffsets[positionCount - 1];
        dictionaryBlock = new VariableWidthBlock(positionCount, wrappedBuffer(dictionaryData), dictionaryOffsets, Optional.of(isNullVector));
        currentDictionaryData = dictionaryData;
        memoryContext.setBytes(getRetainedSizeInBytes());
    }
}
Also used : VariableWidthBlock(io.trino.spi.block.VariableWidthBlock)

Aggregations

VariableWidthBlock (io.trino.spi.block.VariableWidthBlock)6 Slice (io.airlift.slice.Slice)3 Block (io.trino.spi.block.Block)3 Test (org.testng.annotations.Test)3 DictionaryBlock (io.trino.spi.block.DictionaryBlock)2 RunLengthEncodedBlock (io.trino.spi.block.RunLengthEncodedBlock)2 BlockAssertions.createLongSequenceBlock (io.trino.block.BlockAssertions.createLongSequenceBlock)1 BlockAssertions.createLongsBlock (io.trino.block.BlockAssertions.createLongsBlock)1 BlockAssertions.createSlicesBlock (io.trino.block.BlockAssertions.createSlicesBlock)1 BlockAssertions.createStringSequenceBlock (io.trino.block.BlockAssertions.createStringSequenceBlock)1 OrcCorruptionException (io.trino.orc.OrcCorruptionException)1 Page (io.trino.spi.Page)1 TrinoException (io.trino.spi.TrinoException)1 IntArrayBlock (io.trino.spi.block.IntArrayBlock)1 TypeTestUtils.getHashBlock (io.trino.type.TypeTestUtils.getHashBlock)1