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

kou 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 e8e50a3ca9 GH-34324: [CI][C++] Specify set element type explicitly for 
old g++ (#34325)
e8e50a3ca9 is described below

commit e8e50a3ca96ec8eb2f2beb383cf9005ce1c93486
Author: Sutou Kouhei <[email protected]>
AuthorDate: Fri Feb 24 16:47:32 2023 +0900

    GH-34324: [CI][C++] Specify set element type explicitly for old g++ (#34325)
    
    ### Rationale for this change
    
    `std::set(iterator, iterator)` doesn't work with old g++ on Ubuntu 18.04:
    
        FAILED: 
src/arrow/util/CMakeFiles/arrow-utility-test.dir/rows_to_batches_test.cc.o
        c++  ... -std=c++1z ... -c 
/arrow/cpp/src/arrow/util/rows_to_batches_test.cc
        /arrow/cpp/src/arrow/util/rows_to_batches_test.cc: In lambda function:
        /arrow/cpp/src/arrow/util/rows_to_batches_test.cc:85:61: error: class 
template argument deduction failed:
             return std::set(std::begin(s.values), std::end(s.values));
                                                                     ^
        /arrow/cpp/src/arrow/util/rows_to_batches_test.cc:85:61: error: no 
matching function for call to 'set(std::vector<int>::const_iterator, 
std::vector<int>::const_iterator)'
        In file included from /usr/include/c++/7/set:61:0,
                         from 
googletest_ep-prefix/include/gtest/internal/gtest-internal.h:60,
                         from googletest_ep-prefix/include/gtest/gtest.h:62,
                         from 
/arrow/cpp/src/arrow/util/rows_to_batches_test.cc:20:
        /usr/include/c++/7/bits/stl_set.h:261:2: note: candidate: 
template<class _Key, class _Compare, class _Alloc, class _InputIterator> 
set(_InputIterator, _InputIterator, const _Alloc&)-> std::set<_Key, _Compare, 
_Alloc>
          set(_InputIterator __first, _InputIterator __last,
          ^~~
        /usr/include/c++/7/bits/stl_set.h:261:2: note:   template argument 
deduction/substitution failed:
        /arrow/cpp/src/arrow/util/rows_to_batches_test.cc:85:61: note:   
candidate expects 3 arguments, 2 provided
             return std::set(std::begin(s.values), std::end(s.values));
                                                                     ^
        In file included from /usr/include/c++/7/set:61:0,
                         from 
googletest_ep-prefix/include/gtest/internal/gtest-internal.h:60,
                         from googletest_ep-prefix/include/gtest/gtest.h:62,
                         from 
/arrow/cpp/src/arrow/util/rows_to_batches_test.cc:20:
        /usr/include/c++/7/bits/stl_set.h:255:7: note: candidate: 
template<class _Key, class _Compare, class _Alloc> 
set(std::initializer_list<_Tp>, const allocator_type&)-> std::set<_Key, 
_Compare, _Alloc>
               set(initializer_list<value_type> __l, const allocator_type& __a)
               ^~~
        ...
    
    ### What changes are included in this PR?
    
    Specify type explicitly.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    No.
    * Closes: #34324
    
    Authored-by: Sutou Kouhei <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/util/rows_to_batches_test.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpp/src/arrow/util/rows_to_batches_test.cc 
b/cpp/src/arrow/util/rows_to_batches_test.cc
index 52415fcbde..c05d175f28 100644
--- a/cpp/src/arrow/util/rows_to_batches_test.cc
+++ b/cpp/src/arrow/util/rows_to_batches_test.cc
@@ -82,7 +82,7 @@ TEST(RowsToBatches, StructAccessor) {
 
   // Test accessor that returns by value instead of using 
`std::reference_wrapper`
   auto accessor_by_value = [](const TestStruct& s) -> Result<std::set<int>> {
-    return std::set(std::begin(s.values), std::end(s.values));
+    return std::set<int>(std::begin(s.values), std::end(s.values));
   };
   auto batches_by_value =
       RowsToBatches(kTestSchema, data, IntConvertor, 
accessor_by_value).ValueOrDie();

Reply via email to