| 835 | } |
| 836 | |
| 837 | std::unique_ptr<StripeStatistics> ReaderImpl::getStripeStatistics(uint64_t stripeIndex, |
| 838 | bool includeRowIndex) const { |
| 839 | if (!isMetadataLoaded_) { |
| 840 | readMetadata(); |
| 841 | } |
| 842 | if (contents_->metadata == nullptr) { |
| 843 | throw std::logic_error("No stripe statistics in file"); |
| 844 | } |
| 845 | |
| 846 | proto::StripeInformation currentStripeInfo = footer_->stripes(static_cast<int>(stripeIndex)); |
| 847 | proto::StripeFooter currentStripeFooter = getStripeFooter(currentStripeInfo, *contents_.get()); |
| 848 | |
| 849 | const Timezone& writerTZ = currentStripeFooter.has_writer_timezone() |
| 850 | ? getTimezoneByName(currentStripeFooter.writer_timezone()) |
| 851 | : getLocalTimezone(); |
| 852 | StatContext statContext(hasCorrectStatistics(), &writerTZ); |
| 853 | |
| 854 | if (!includeRowIndex) { |
| 855 | return std::make_unique<StripeStatisticsImpl>( |
| 856 | contents_->metadata->stripe_stats(static_cast<int>(stripeIndex)), statContext); |
| 857 | } |
| 858 | |
| 859 | size_t num_cols = static_cast<size_t>( |
| 860 | contents_->metadata->stripe_stats(static_cast<int>(stripeIndex)).col_stats_size()); |
| 861 | std::vector<std::vector<proto::ColumnStatistics>> indexStats(num_cols); |
| 862 | |
| 863 | getRowIndexStatistics(currentStripeInfo, stripeIndex, currentStripeFooter, &indexStats); |
| 864 | |
| 865 | return std::make_unique<StripeStatisticsWithRowGroupIndexImpl>( |
| 866 | contents_->metadata->stripe_stats(static_cast<int>(stripeIndex)), indexStats, statContext); |
| 867 | } |
| 868 | |
| 869 | std::unique_ptr<Statistics> ReaderImpl::getStatistics() const { |
| 870 | StatContext statContext(hasCorrectStatistics()); |
nothing calls this directly
no test coverage detected