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

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


The following commit(s) were added to refs/heads/main by this push:
     new bfb921998c GH-37276: [C++] Skip multithread tests on single thread env 
(#37327)
bfb921998c is described below

commit bfb921998c6f2b24c7de05ee78b6935366b51a1a
Author: Jin Shang <[email protected]>
AuthorDate: Wed Aug 23 19:04:26 2023 +0800

    GH-37276: [C++] Skip multithread tests on single thread env (#37327)
    
    
    
    ### Rationale for this change
    
    Some tests assume a multi-threaded environment without checking the actual 
threading capacity. Given that they intend to check the behavior of 
multi-threaded execution, they should be skipped if there is only one thread 
available.
    
    ### What changes are included in this PR?
    
    `SegmentedAggregationWithMultiThreading` and `InvalidRowsSkippedAsync` are 
skipped if there is only one thread available in the default ThreadPool.
    
    ### Are these changes tested?
    
    Tested on my local machine. Unfortunately there is no single core CI 
pipeline avaible.
    
    ### Are there any user-facing changes?
     No.
    
    * Closes: #37276
    
    Authored-by: Jin Shang <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/acero/plan_test.cc | 3 +++
 cpp/src/arrow/csv/reader_test.cc | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/cpp/src/arrow/acero/plan_test.cc b/cpp/src/arrow/acero/plan_test.cc
index 03e10483eb..e74ad6a666 100644
--- a/cpp/src/arrow/acero/plan_test.cc
+++ b/cpp/src/arrow/acero/plan_test.cc
@@ -1623,6 +1623,9 @@ TEST(ExecPlanExecution, 
SegmentedAggregationWithMultiThreading) {
 #ifndef ARROW_ENABLE_THREADING
   GTEST_SKIP() << "Test requires threading enabled";
 #endif
+  if (internal::GetCpuThreadPool()->GetCapacity() < 2) {
+    GTEST_SKIP() << "Test requires at least 2 threads";
+  }
   BatchesWithSchema data;
   data.batches = {ExecBatchFromJSON({int32()}, "[[1]]")};
   data.schema = schema({field("i32", int32())});
diff --git a/cpp/src/arrow/csv/reader_test.cc b/cpp/src/arrow/csv/reader_test.cc
index 9febdc243c..57cc7d8efa 100644
--- a/cpp/src/arrow/csv/reader_test.cc
+++ b/cpp/src/arrow/csv/reader_test.cc
@@ -315,6 +315,9 @@ TEST(StreamingReaderTests, InvalidRowsSkipped) {
   TestInvalidRowsSkipped(MakeStreamingFactory(/*use_threads=*/false), 
/*async=*/false);
 }
 TEST(StreamingReaderTests, InvalidRowsSkippedAsync) {
+  if (internal::GetCpuThreadPool()->GetCapacity() < 2) {
+    GTEST_SKIP() << "Test requires at least 2 threads";
+  }
   TestInvalidRowsSkipped(MakeStreamingFactory(), /*async=*/true);
 }
 

Reply via email to