presto-orc/src/main/java/io/prestosql/orc/reader/SliceDictionaryColumnReader.java/SliceDictionaryColumnReader/openRowGroup
class SliceDictionaryColumnReader:    private void openRowGroup()
            throws IOException
    {
        // read the dictionary
        if (!dictionaryOpen) {
            if (dictionarySize > 0) {
                // resize the dictionary lengths array if necessary
                if (dictionaryLength.length < dictionarySize) {
                    dictionaryLength = new int[dictionarySize];
                }

                // read the lengths
                LongInputStream lengthStream = dictionaryLengthStreamSource.openStream();
                if (lengthStream == null) {
                    throw new OrcCorruptionException(column.getOrcDataSourceId(), "Dictionary is not empty but dictionary length stream is missing");
                }
                lengthStream.next(dictionaryLength, dictionarySize);

                long dataLength = 0;
                for (int i = 0; i < dictionarySize; i++) {
                    dataLength += dictionaryLength[i];
                }

                // we must always create a new dictionary array because the previous dictionary may still be referenced
                dictionaryData = new byte[toIntExact(dataLength)];
                // add one extra entry for null
                dictionaryOffsetVector = new int[dictionarySize + 2];

                // read dictionary values
                ByteArrayInputStream dictionaryDataStream = dictionaryDataStreamSource.openStream();
                readDictionary(dictionaryDataStream, dictionarySize, dictionaryLength, 0, dictionaryData, dictionaryOffsetVector, maxCodePointCount, isCharType);
            }
            else {
                dictionaryData = EMPTY_DICTIONARY_DATA;
                dictionaryOffsetVector = EMPTY_DICTIONARY_OFFSETS;
            }
        }
        dictionaryOpen = true;

        setDictionaryBlockData(dictionaryData, dictionaryOffsetVector, dictionarySize + 1);

        presentStream = presentStreamSource.openStream();
        dataStream = dataStreamSource.openStream();

        rowGroupOpen = true;
    }