Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-16652

[Python][C++] Cast compute kernel segfaults when called with a Table

    XMLWordPrintableJSON

Details

    Description

      Passing a Table to {pyarrow.compute.cast with a scalar type gives a segfault:

      In [1]: table = pa.table({'a': [1, 2]})
      
      In [2]: import pyarrow.compute as pc
      
      In [3]: pc.cast(table, pa.int64())
      Segmentation fault (core dumped)
      

      Backtrace with gdb gives:

      Thread 1 "python" received signal SIGSEGV, Segmentation fault.
      0x00007fba01685ada in arrow::DataType::id (this=0x0) at ../src/arrow/type.h:172
      172	  Type::type id() const { return id_; }
      (gdb) bt
      #0  0x00007fba01685ada in arrow::DataType::id (this=0x0) at ../src/arrow/type.h:172
      #1  0x00007fba019e150e in arrow::TypeEquals (left=..., right=..., check_metadata=false) at ../src/arrow/compare.cc:1304
      #2  0x00007fba01b3484a in arrow::DataType::Equals (this=0x0, other=..., check_metadata=false) at ../src/arrow/type.cc:374
      #3  0x00007fba01f31678 in arrow::compute::internal::(anonymous namespace)::CastMetaFunction::ExecuteImpl (this=0x55b6ebe63860, args=..., options=0x55b6ec377080, ctx=0x7ffcd8cd43a0)
          at ../src/arrow/compute/cast.cc:116
      #4  0x00007fba020d9f39 in arrow::compute::MetaFunction::Execute (this=0x55b6ebe63860, args=..., options=0x55b6ec377080, ctx=0x7ffcd8cd43a0) at ../src/arrow/compute/function.cc:388
      #5  0x00007fb9ba95c8d9 in __pyx_pf_7pyarrow_8_compute_8Function_6call (__pyx_v_self=0x7fb9b7c19af0, __pyx_v_args=[<pyarrow.lib.Table at remote 0x7fb9b7c19c70>], __pyx_v_options=0x7fb9b7c1c310, 
          __pyx_v_memory_pool=0x55b6ea466d60 <_Py_NoneStruct>) at /home/joris/scipy/repos/arrow/python/build/temp.linux-x86_64-3.8/_compute.cpp:11292
      #6  0x00007fb9ba95c3d5 in __pyx_pw_7pyarrow_8_compute_8Function_7call (__pyx_v_self=<pyarrow._compute.MetaFunction at remote 0x7fb9b7c19af0>, __pyx_args=([<pyarrow.lib.Table at remote 0x7fb9b7c19c70>],), 
          __pyx_kwds={'options': <CastOptions at remote 0x7fb9b7c1c310>, 'memory_pool': None}) at /home/joris/scipy/repos/arrow/python/build/temp.linux-x86_64-3.8/_compute.cpp:11165
      #7  0x000055b6ea1fb814 in cfunction_call_varargs (kwargs=<optimized out>, args=<optimized out>, func=<built-in method call of pyarrow._compute.MetaFunction object at remote 0x7fb9b7c19af0>)
          at /home/conda/feedstock_root/build_artifacts/python-split_1606502903469/work/Objects/call.c:772
      #8  PyCFunction_Call (func=<built-in method call of pyarrow._compute.MetaFunction object at remote 0x7fb9b7c19af0>, args=<optimized out>, kwargs=<optimized out>)
          at /home/conda/feedstock_root/build_artifacts/python-split_1606502903469/work/Objects/call.c:772
      #9  0x00007fb9ba9e84e2 in __Pyx_PyObject_Call (func=<built-in method call of pyarrow._compute.MetaFunction object at remote 0x7fb9b7c19af0>, arg=([<pyarrow.lib.Table at remote 0x7fb9b7c19c70>],), 
          kw={'options': <CastOptions at remote 0x7fb9b7c1c310>, 'memory_pool': None}) at /home/joris/scipy/repos/arrow/python/build/temp.linux-x86_64-3.8/_compute.cpp:57961
      #10 0x00007fb9ba961add in __pyx_pf_7pyarrow_8_compute_6call_function (__pyx_self=0x0, __pyx_v_name='cast', __pyx_v_args=[<pyarrow.lib.Table at remote 0x7fb9b7c19c70>], 
          __pyx_v_options=<CastOptions at remote 0x7fb9b7c1c310>, __pyx_v_memory_pool=None) at /home/joris/scipy/repos/arrow/python/build/temp.linux-x86_64-3.8/_compute.cpp:13408
      #11 0x00007fb9ba961676 in __pyx_pw_7pyarrow_8_compute_7call_function (__pyx_self=0x0, __pyx_args=('cast', [<pyarrow.lib.Table at remote 0x7fb9b7c19c70>], <CastOptions at remote 0x7fb9b7c1c310>), __pyx_kwds=0x0)
      ...
      
      

      Attachments

        Issue Links

          Activity

            People

              kshitij12345 Kshiteej K
              jorisvandenbossche Joris Van den Bossche
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 40m
                  2h 40m