Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5465

TEnumIterator lacks equality operator and fails when used in gcc debug containers.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • C++ - Library
    • None
    • Compiler: (GCC) 11.1.0

      OS: Arch Linux

    Description

      When compiling Apache arrow parquet like so:

      cmake ../ -DCMAKE_BUILD_TYPE=DEBUG -DARROW_CXXFLAGS="-D_GLIBCXX_DEBUG" -DARROW_PARQUET=1 

      The following error occurs in thrift compiler generated code:

      /usr/include/c++/11.1.0/debug/map.h:151:5:   required from ‘std::__debug::map<_Key, _Tp, _Cmp, _Allocator>::map(_InputIterator, _InputIterator, const _Compare&, const _Allocator&) [with _InputIterator = apache::thrift::TEnumIterator; _Key = int; _Tp = co
      nst char*; _Compare = std::less<int>; _Allocator = std::allocator<std::pair<const int, const char*> >]’                        
      /home/snapcore/arrow/cpp/src/generated/parquet_types.cpp:36:166:   required from here                                                                                                                                                                         
      /usr/include/c++/11.1.0/debug/helper_functions.h:174:22: error: no match foroperator==’ (operand types are ‘apache::thrift::TEnumIterator’ and ‘apache::thrift::TEnumIterator’)                                                                             
        174 |       return __first == __last                                                
      

      This is because the type TEnumIterator is being stored in a stl debug map:

      const std::map<int, const char*> _Type_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kTypeValues, _kTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
      

      that does an equality comparison on types stored for validity, but TEnumIterator lacks a comparison operator on non-windows platforms it seems:

      A very simple solution here is to add to Thrift.h:

      #include <thrift/windows/Operators.h>

      which includes a dummy comparison operator I believe. Probably not ideal, but that is the current workaround I found.

      Attachments

        Activity

          People

            Unassigned Unassigned
            snapcore Joshua L
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: