| 256 | proto::Stream_Kind_ROW_INDEX, proto::Stream_Kind_BLOOM_FILTER_UTF8}; |
| 257 | |
| 258 | std::vector<ReadRange> extractReadRangesForStripe( |
| 259 | uint64_t stripeIndex, const proto::StripeInformation& stripeInfo, |
| 260 | const proto::StripeFooter& stripeFooter, const std::vector<bool>& selectedColumns, |
| 261 | const std::unordered_set<proto::Stream_Kind>& allowedKinds = DATA_STREAM_KINDS) { |
| 262 | std::vector<ReadRange> ranges; |
| 263 | |
| 264 | uint64_t stripeFooterStart = |
| 265 | stripeInfo.offset() + stripeInfo.index_length() + stripeInfo.data_length(); |
| 266 | uint64_t offset = stripeInfo.offset(); |
| 267 | |
| 268 | for (int i = 0; i < stripeFooter.streams_size(); i++) { |
| 269 | const proto::Stream& stream = stripeFooter.streams(i); |
| 270 | if (offset + stream.length() > stripeFooterStart) { |
| 271 | std::stringstream msg; |
| 272 | msg << "Malformed stream meta at stream index " << i << " in stripe " << stripeIndex |
| 273 | << ": streamOffset=" << offset << ", streamLength=" << stream.length() |
| 274 | << ", stripeOffset=" << stripeInfo.offset() |
| 275 | << ", stripeIndexLength=" << stripeInfo.index_length() |
| 276 | << ", stripeDataLength=" << stripeInfo.data_length(); |
| 277 | throw ParseError(msg.str()); |
| 278 | } |
| 279 | |
| 280 | if (stream.has_kind() && selectedColumns[stream.column()]) { |
| 281 | if (allowedKinds.find(stream.kind()) != allowedKinds.cend()) { |
| 282 | ranges.emplace_back(offset, stream.length()); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | offset += stream.length(); |
| 287 | } |
| 288 | |
| 289 | return ranges; |
| 290 | } |
| 291 | |
| 292 | RowReaderImpl::RowReaderImpl(std::shared_ptr<FileContents> contents, const RowReaderOptions& opts) |
| 293 | : localTimezone_(getLocalTimezone()), |
no test coverage detected