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

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new e1f185eed ORC-1654: [C++] Count up EvaluatedRowGroupCount correctly
e1f185eed is described below

commit e1f185eedd7dc0d9d60339117c9299f5b26ddeaf
Author: ffacs <[email protected]>
AuthorDate: Thu Mar 14 09:38:41 2024 +0800

    ORC-1654: [C++] Count up EvaluatedRowGroupCount correctly
    
    ### What changes were proposed in this pull request?
    Count up EvaluatedRowGroupCount correctly.
    
    ### Why are the changes needed?
    to fix https://github.com/apache/orc/issues/1829
    
    ### How was this patch tested?
    UT passed
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #1844 from ffacs/ORC-1654.
    
    Authored-by: ffacs <[email protected]>
    Signed-off-by: Gang Wu <[email protected]>
---
 c++/src/sargs/SargsApplier.cc | 8 ++++----
 c++/test/TestSargsApplier.cc  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/c++/src/sargs/SargsApplier.cc b/c++/src/sargs/SargsApplier.cc
index 7032a8812..0e369bf45 100644
--- a/c++/src/sargs/SargsApplier.cc
+++ b/c++/src/sargs/SargsApplier.cc
@@ -160,12 +160,12 @@ namespace orc {
     }
 
     bool ret = evaluateColumnStatistics(stripeStats.col_stats());
+    if (mMetrics != nullptr) {
+      mMetrics->EvaluatedRowGroupCount.fetch_add(stripeRowGroupCount);
+    }
     if (!ret) {
       // reset mNextSkippedRows when the current stripe does not satisfy the 
PPD
       mNextSkippedRows.clear();
-      if (mMetrics != nullptr) {
-        mMetrics->EvaluatedRowGroupCount.fetch_add(stripeRowGroupCount);
-      }
     }
     return ret;
   }
@@ -177,7 +177,7 @@ namespace orc {
         mFileStatsEvalResult = true;
       } else {
         mFileStatsEvalResult = evaluateColumnStatistics(footer.statistics());
-        if (!mFileStatsEvalResult && mMetrics != nullptr) {
+        if (mMetrics != nullptr) {
           
mMetrics->EvaluatedRowGroupCount.fetch_add(numRowGroupsInStripeRange);
         }
       }
diff --git a/c++/test/TestSargsApplier.cc b/c++/test/TestSargsApplier.cc
index 2ba927a5f..7105c738e 100644
--- a/c++/test/TestSargsApplier.cc
+++ b/c++/test/TestSargsApplier.cc
@@ -139,7 +139,7 @@ namespace orc {
       SargsApplier applier(*type, sarg.get(), 1000, WriterVersion_ORC_135, 
&metrics);
       EXPECT_TRUE(applier.evaluateStripeStatistics(stripeStats, 1));
       EXPECT_EQ(metrics.SelectedRowGroupCount.load(), 0);
-      EXPECT_EQ(metrics.EvaluatedRowGroupCount.load(), 0);
+      EXPECT_EQ(metrics.EvaluatedRowGroupCount.load(), 1);
     }
     // Test file stats 0 <= x <= 10 and 0 <= y <= 50
     {
@@ -181,7 +181,7 @@ namespace orc {
       SargsApplier applier(*type, sarg.get(), 1000, WriterVersion_ORC_135, 
&metrics);
       EXPECT_TRUE(applier.evaluateFileStatistics(footer, 1));
       EXPECT_EQ(metrics.SelectedRowGroupCount.load(), 0);
-      EXPECT_EQ(metrics.EvaluatedRowGroupCount.load(), 0);
+      EXPECT_EQ(metrics.EvaluatedRowGroupCount.load(), 1);
     }
   }
 }  // namespace orc

Reply via email to