use of com.facebook.presto.orc.metadata.DwrfSequenceEncoding in project presto by prestodb.
the class MapFlatSelectiveStreamReader method startStripe.
@Override
public void startStripe(Stripe stripe) throws IOException {
presentStreamSource = missingStreamSource(BooleanInputStream.class);
inMapStreamSources.clear();
valueStreamDescriptors.clear();
valueStreamReaders.clear();
ColumnEncoding encoding = stripe.getColumnEncodings().get(baseValueStreamDescriptor.getStreamId());
SortedMap<Integer, DwrfSequenceEncoding> additionalSequenceEncodings = Collections.emptySortedMap();
// encoding or encoding.getAdditionalSequenceEncodings() may not be present when every map is empty or null
if (encoding != null && encoding.getAdditionalSequenceEncodings().isPresent()) {
additionalSequenceEncodings = encoding.getAdditionalSequenceEncodings().get();
}
keyIndices = ensureCapacity(keyIndices, additionalSequenceEncodings.size());
keyCount = 0;
// The ColumnEncoding with sequence ID 0 doesn't have any data associated with it
int keyIndex = 0;
for (Map.Entry<Integer, DwrfSequenceEncoding> entry : additionalSequenceEncodings.entrySet()) {
if (!isRequiredKey(entry.getValue())) {
keyIndex++;
continue;
}
keyIndices[keyCount] = keyIndex;
keyCount++;
keyIndex++;
int sequence = entry.getKey();
inMapStreamSources.add(missingStreamSource(BooleanInputStream.class));
StreamDescriptor valueStreamDescriptor = copyStreamDescriptorWithSequence(baseValueStreamDescriptor, sequence);
valueStreamDescriptors.add(valueStreamDescriptor);
SelectiveStreamReader valueStreamReader = SelectiveStreamReaders.createStreamReader(valueStreamDescriptor, ImmutableBiMap.of(), Optional.ofNullable(outputType).map(MapType::getValueType), ImmutableList.of(), hiveStorageTimeZone, options, legacyMapSubscript, systemMemoryContext.newOrcAggregatedMemoryContext());
valueStreamReader.startStripe(stripe);
valueStreamReaders.add(valueStreamReader);
}
keyBlock = getKeysBlock(ImmutableList.copyOf(additionalSequenceEncodings.values()));
readOffset = 0;
presentStream = null;
rowGroupOpen = false;
}
Aggregations