Joris Van den Bossche created ARROW-16652: ---------------------------------------------
Summary: [Python][C++] Cast compute kernel segfaults when called with a Table Key: ARROW-16652 URL: https://issues.apache.org/jira/browse/ARROW-16652 Project: Apache Arrow Issue Type: Bug Components: C++, Python Reporter: Joris Van den Bossche Passing a Table to {{{pyarrow.compute.cast}} with a scalar type gives a segfault: {code} 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) {code} Backtrace with gdb gives: {code} 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) ... {code} -- This message was sent by Atlassian Jira (v8.20.7#820007)