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

Method RowReaderImpl

c++/src/Reader.cc:292–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290 }
291
292 RowReaderImpl::RowReaderImpl(std::shared_ptr<FileContents> contents, const RowReaderOptions& opts)
293 : localTimezone_(getLocalTimezone()),
294 contents_(contents),
295 throwOnHive11DecimalOverflow_(opts.getThrowOnHive11DecimalOverflow()),
296 forcedScaleOnHive11Decimal_(opts.getForcedScaleOnHive11Decimal()),
297 enableAsyncPrefetch_(opts.getEnableAsyncPrefetch()),
298 smallStripeLookAheadLimit_(opts.getSmallStripeLookAheadLimit()),
299 footer_(contents_->footer.get()),
300 firstRowOfStripe_(*contents_->pool, 0),
301 enableEncodedBlock_(opts.getEnableLazyDecoding()),
302 readerTimezone_(getTimezoneByName(opts.getTimezoneName())),
303 schemaEvolution_(opts.getReadType(), contents_->schema.get()) {
304 uint64_t numberOfStripes;
305 numberOfStripes = static_cast<uint64_t>(footer_->stripes_size());
306 currentStripe_ = numberOfStripes;
307 lastStripe_ = 0;
308 currentRowInStripe_ = 0;
309 rowsInCurrentStripe_ = 0;
310 numRowGroupsInStripeRange_ = 0;
311 useTightNumericVector_ = opts.getUseTightNumericVector();
312 throwOnSchemaEvolutionOverflow_ = opts.getThrowOnSchemaEvolutionOverflow();
313 uint64_t rowTotal = 0;
314
315 firstRowOfStripe_.resize(numberOfStripes);
316 for (size_t i = 0; i < numberOfStripes; ++i) {
317 firstRowOfStripe_[i] = rowTotal;
318 proto::StripeInformation stripeInfo = footer_->stripes(static_cast<int>(i));
319 rowTotal += stripeInfo.number_of_rows();
320 bool isStripeInRange = stripeInfo.offset() >= opts.getOffset() &&
321 stripeInfo.offset() < opts.getOffset() + opts.getLength();
322 if (isStripeInRange) {
323 if (i < currentStripe_) {
324 currentStripe_ = i;
325 }
326 if (i >= lastStripe_) {
327 lastStripe_ = i + 1;
328 }
329 if (footer_->row_index_stride() > 0) {
330 numRowGroupsInStripeRange_ +=
331 (stripeInfo.number_of_rows() + footer_->row_index_stride() - 1) /
332 footer_->row_index_stride();
333 }
334 }
335 }
336 firstStripe_ = currentStripe_;
337 processingStripe_ = lastStripe_;
338
339 if (currentStripe_ == 0) {
340 previousRow_ = (std::numeric_limits<uint64_t>::max)();
341 } else if (currentStripe_ == numberOfStripes) {
342 previousRow_ = footer_->number_of_rows();
343 } else {
344 previousRow_ = firstRowOfStripe_[firstStripe_] - 1;
345 }
346
347 ColumnSelector column_selector(contents_.get());
348 column_selector.updateSelected(selectedColumns_, opts);
349

Callers

nothing calls this directly

Calls 15

getWriterVersionImplFunction · 0.85
getEnableLazyDecodingMethod · 0.80
getOffsetMethod · 0.65
getLengthMethod · 0.65
getMethod · 0.45
getReadTypeMethod · 0.45

Tested by

no test coverage detected