coderex2522 commented on a change in pull request #1073: URL: https://github.com/apache/orc/pull/1073#discussion_r841001950
########## File path: c++/src/sargs/SargsApplier.cc ########## @@ -122,4 +124,58 @@ namespace orc { return mHasSelected; } + bool SargsApplier::evaluateColumnStatistics( + const PbColumnStatistics& colStats) const { + const auto& leaves = + dynamic_cast<const SearchArgumentImpl *>(mSearchArgument)->getLeaves(); + std::vector<TruthValue> leafValues( + leaves.size(), TruthValue::YES_NO_NULL); + + for (size_t pred = 0; pred != leaves.size(); ++pred) { + uint64_t columnId = mFilterColumns[pred]; + if (columnId == INVALID_COLUMN_ID) { + // this column does not exist in current file + leafValues[pred] = TruthValue::YES_NO_NULL; + } else if (colStats.size() <= static_cast<int>(columnId)) { + // column stats does not exist + leafValues[pred] = TruthValue::YES_NO_NULL; + } else { + leafValues[pred] = leaves[pred].evaluate( + mWriterVersion, colStats.Get(static_cast<int>(columnId)), nullptr); + } + } + + return isNeeded(mSearchArgument->evaluate(leafValues)); + } + + bool SargsApplier::evaluateStripeStatistics( + uint64_t rowsInStripe, + const proto::StripeStatistics& stripeStats) { + if (stripeStats.colstats_size() == 0) { + return true; + } + + bool ret = evaluateColumnStatistics(stripeStats.colstats()); + if (!ret) { + // allocate evaluation result for row groups + uint64_t groupsInStripe = + (rowsInStripe + mRowIndexStride - 1) / mRowIndexStride; Review comment: Add the 'mRowIndexStride > 0' conditional judgment. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@orc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org