MCPcopy Create free account
hub / github.com/apache/orc / getStream

Method getStream

c++/src/StripeStream.cc:82–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 std::unique_ptr<SeekableInputStream> StripeStreamsImpl::getStream(uint64_t columnId,
83 proto::Stream_Kind kind,
84 bool shouldStream) const {
85 uint64_t offset = stripeStart_;
86 uint64_t dataEnd =
87 stripeInfo_.offset() + stripeInfo_.index_length() + stripeInfo_.data_length();
88 MemoryPool* pool = reader_.getFileContents().pool;
89 for (int i = 0; i < footer_.streams_size(); ++i) {
90 const proto::Stream& stream = footer_.streams(i);
91 if (stream.has_kind() && stream.kind() == kind &&
92 stream.column() == static_cast<uint64_t>(columnId)) {
93 uint64_t streamLength = stream.length();
94 if (offset + streamLength > dataEnd) {
95 std::stringstream msg;
96 msg << "Malformed stream meta at stream index " << i << " in stripe " << stripeIndex_
97 << ": streamOffset=" << offset << ", streamLength=" << streamLength
98 << ", stripeOffset=" << stripeInfo_.offset()
99 << ", stripeIndexLength=" << stripeInfo_.index_length()
100 << ", stripeDataLength=" << stripeInfo_.data_length();
101 throw ParseError(msg.str());
102 }
103
104 BufferSlice slice;
105 if (readCache_) {
106 ReadRange range{offset, streamLength};
107 slice = readCache_->read(range);
108 }
109
110 uint64_t myBlock = shouldStream ? input_.getNaturalReadSize() : streamLength;
111 std::unique_ptr<SeekableInputStream> seekableInput;
112 if (slice.buffer) {
113 seekableInput = std::make_unique<SeekableArrayInputStream>(
114 slice.buffer->data() + slice.offset, slice.length);
115 } else {
116 seekableInput = std::make_unique<SeekableFileInputStream>(&input_, offset, streamLength,
117 *pool, myBlock);
118 }
119 return createDecompressor(reader_.getCompression(), std::move(seekableInput),
120 reader_.getCompressionSize(), *pool,
121 reader_.getFileContents().readerMetrics);
122 }
123 offset += stream.length();
124 }
125 return nullptr;
126 }
127
128 MemoryPool& StripeStreamsImpl::getMemoryPool() const {
129 return *reader_.getFileContents().pool;

Callers 14

ColumnReaderMethod · 0.45
BooleanColumnReaderMethod · 0.45
ByteColumnReaderMethod · 0.45
IntegerColumnReaderMethod · 0.45
TimestampColumnReaderMethod · 0.45
DoubleColumnReaderMethod · 0.45
ListColumnReaderMethod · 0.45
MapColumnReaderMethod · 0.45
UnionColumnReaderMethod · 0.45
Decimal64ColumnReaderMethod · 0.45

Calls 8

ParseErrorClass · 0.85
createDecompressorFunction · 0.85
lengthMethod · 0.80
readMethod · 0.65
getCompressionSizeMethod · 0.65
getNaturalReadSizeMethod · 0.45
dataMethod · 0.45
getCompressionMethod · 0.45

Tested by

no test coverage detected