This is an automated email from the ASF dual-hosted git repository.

kakachen pushed a commit to branch orc
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/orc by this push:
     new 89060c7a5e4 [Enhancement] Add ReadRowCount metric.
89060c7a5e4 is described below

commit 89060c7a5e4c6d53a4e4ddc6cccd90ee4b4afeca
Author: Qi Chen <[email protected]>
AuthorDate: Tue Jul 22 20:06:50 2025 +0800

    [Enhancement] Add ReadRowCount metric.
---
 c++/include/orc/Reader.hh     |  1 +
 c++/src/Reader.cc             |  1 +
 c++/src/sargs/SargsApplier.cc | 16 +++++++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/c++/include/orc/Reader.hh b/c++/include/orc/Reader.hh
index e3abb143b4a..96a431faae8 100644
--- a/c++/include/orc/Reader.hh
+++ b/c++/include/orc/Reader.hh
@@ -60,6 +60,7 @@ namespace orc {
     std::atomic<uint64_t> IOBlockingLatencyUs{0};
     std::atomic<uint64_t> SelectedRowGroupCount{0};
     std::atomic<uint64_t> EvaluatedRowGroupCount{0};
+    std::atomic<uint64_t> ReadRowCount{0};
   };
   ReaderMetrics* getDefaultReaderMetrics();
 
diff --git a/c++/src/Reader.cc b/c++/src/Reader.cc
index 13e1b82d4e3..89bdd77bc6e 100644
--- a/c++/src/Reader.cc
+++ b/c++/src/Reader.cc
@@ -1249,6 +1249,7 @@ namespace orc {
           continue;
         }
       } else {
+        contents->readerMetrics->ReadRowCount.fetch_add(rowsInCurrentStripe);
         if (filter) {
           // read row group statistics and bloom filters of current stripe
           loadStripeIndex();
diff --git a/c++/src/sargs/SargsApplier.cc b/c++/src/sargs/SargsApplier.cc
index 2cc3a7cf44b..7bce1a61aa8 100644
--- a/c++/src/sargs/SargsApplier.cc
+++ b/c++/src/sargs/SargsApplier.cc
@@ -122,12 +122,22 @@ namespace orc {
     } while (rowGroup != 0);
 
     // update stats
-    uint64_t selectedRGs = std::accumulate(
-        mNextSkippedRows.cbegin(), mNextSkippedRows.cend(), 0UL,
-        [](uint64_t initVal, uint64_t rg) { return rg > 0 ? initVal + 1 : 
initVal; });
+    uint64_t selectedRGs = 0;
+    uint64_t selectedReadRows = 0;
+
+    for (size_t i = 0; i < mNextSkippedRows.size(); ++i) {
+      if (mNextSkippedRows[i] > 0) {
+        selectedRGs++;
+        uint64_t rowGroupStartRow = i * mRowIndexStride;
+        uint64_t rowGroupEndRow = std::min((i + 1) * mRowIndexStride, 
rowsInStripe);
+        uint64_t rowsInCurrentRG = rowGroupEndRow - rowGroupStartRow;
+        selectedReadRows += rowsInCurrentRG;
+      }
+    }
     if (mMetrics != nullptr) {
       mMetrics->SelectedRowGroupCount.fetch_add(selectedRGs);
       mMetrics->EvaluatedRowGroupCount.fetch_add(groupsInStripe);
+      mMetrics->ReadRowCount.fetch_add(selectedReadRows);
     }
 
     return mHasSelected;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to