Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.0.0
-
Ubuntu 18.04
Description
Consider the following example: I have an array of timestamp[s]
>>> import pyarrow.compute as pc >>> import pyarrow as pa >>> arr = pc.strptime(['2020-11-01', '2020-11-02', '2020-11-03'], format='%Y-%m-%d', unit='s') >>> arr <pyarrow.lib.TimestampArray object at 0x7f1fc2ef4228> [ 2020-11-01 00:00:00, 2020-11-02 00:00:00, 2020-11-03 00:00:00 ]
I am able to cast the array to date32:
>>> pc.cast(arr, pa.date32())
<pyarrow.lib.Date32Array object at 0x7f1fc2fd3588>
[
2020-11-01,
2020-11-02,
2020-11-03
]
but when I try to do the same with a scalar I get core dumped failure
>>> arr[0] <pyarrow.TimestampScalar: datetime.datetime(2020, 11, 1, 0, 0)> >>> pc.cast(arr[0], pa.date32()) terminate called after throwing an instance of 'mpark::bad_variant_access' what(): bad_variant_access Aborted (core dumped)
Below is a stack trace from gdb
$ gdb /usr/bin/python3 GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/bin/python3...(no debugging symbols found)...done. (gdb) run sample.py Starting program: /usr/bin/python3 sample.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff39ff700 (LWP 4314)] [New Thread 0x7fffebfff700 (LWP 4315)] [New Thread 0x7fffeb7fe700 (LWP 4316)] [New Thread 0x7fffe8ffd700 (LWP 4317)] [New Thread 0x7fffe47fc700 (LWP 4318)] [New Thread 0x7fffe1ffb700 (LWP 4319)] [New Thread 0x7fffdf7fa700 (LWP 4320)] [New Thread 0x7fffdcff9700 (LWP 4321)] [New Thread 0x7fffda7f8700 (LWP 4322)] [New Thread 0x7fffd7ff7700 (LWP 4323)] [New Thread 0x7fffd57f6700 (LWP 4324)] [New Thread 0x7fffd2ff5700 (LWP 4325)] [Thread 0x7fffd2ff5700 (LWP 4325) exited] [Thread 0x7fffd57f6700 (LWP 4324) exited] [Thread 0x7fffd7ff7700 (LWP 4323) exited] [Thread 0x7fffda7f8700 (LWP 4322) exited] [Thread 0x7fffdcff9700 (LWP 4321) exited] [Thread 0x7fffdf7fa700 (LWP 4320) exited] [Thread 0x7fffe1ffb700 (LWP 4319) exited] [Thread 0x7fffe47fc700 (LWP 4318) exited] [Thread 0x7fffe8ffd700 (LWP 4317) exited] [Thread 0x7fffeb7fe700 (LWP 4316) exited] [Thread 0x7fffebfff700 (LWP 4315) exited] terminate called after throwing an instance of 'mpark::bad_variant_access' what(): bad_variant_access Thread 1 "python3" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) backtrace #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007ffff7a248b1 in __GI_abort () at abort.c:79 #2 0x00007ffff477d957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff4783ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff4783b21 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff4783d54 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff5104012 in mpark::throw_bad_variant_access() () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #7 0x00007ffff51e1f51 in arrow::compute::internal::CastFunctor<arrow::Date32Type, arrow::TimestampType, void>::Exec(arrow::compute::KernelContext*, arrow::compute::ExecBatch const&, arrow::Datum*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #8 0x00007ffff52ab5ab in arrow::compute::detail::ScalarExecutor::ExecuteBatch(arrow::compute::ExecBatch const&, arrow::compute::detail::ExecListener*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #9 0x00007ffff52abba1 in arrow::compute::detail::ScalarExecutor::Execute(std::vector<arrow::Datum, std::allocator<arrow::Datum> > const&, arrow::compute::detail::ExecListener*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #10 0x00007ffff529cfe6 in arrow::compute::Function::Execute(std::vector<arrow::Datum, std::allocator<arrow::Datum> > const&, arrow::compute::FunctionOptions const*, arrow::compute::ExecContext*) const [clone .localalias.47] () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #11 0x00007ffff52a5878 in arrow::compute::internal::CastMetaFunction::ExecuteImpl(std::vector<arrow::Datum, std::allocator<arrow::Datum> > const&, arrow::compute::FunctionOptions const*, arrow::compute::ExecContext*) const () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #12 0x00007ffff5299f8f in arrow::compute::MetaFunction::Execute(std::vector<arrow::Datum, std::allocator<arrow::Datum> > const&, arrow::compute::FunctionOptions const*, arrow::compute::ExecContext*) const [clone .localalias.48] () from /usr/local/lib/python3.6/dist-packages/pyarrow/libarrow.so.200 #13 0x00007fffebb685a0 in __pyx_pf_7pyarrow_8_compute_8Function_6call(__pyx_obj_7pyarrow_8_compute_Function*, _object*, __pyx_obj_7pyarrow_8_compute_FunctionOptions*, __pyx_obj_7pyarrow_3lib_MemoryPool*) [clone .isra.455] () from /usr/local/lib/python3.6/dist-packages/pyarrow/_compute.cpython-36m-x86_64-linux-gnu.so #14 0x00007fffebb69309 in __pyx_pw_7pyarrow_8_compute_8Function_7call(_object*, _object*, _object*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/_compute.cpython-36m-x86_64-linux-gnu.so #15 0x0000000000566f73 in PyCFunction_Call () #16 0x00007fffebb5a855 in __Pyx_PyObject_Call(_object*, _object*, _object*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/_compute.cpython-36m-x86_64-linux-gnu.so #17 0x00007fffebb6565a in __pyx_pw_7pyarrow_8_compute_7call_function(_object*, _object*, _object*) () from /usr/local/lib/python3.6/dist-packages/pyarrow/_compute.cpython-36m-x86_64-linux-gnu.so #18 0x000000000050a4a5 in ?? () #19 0x000000000050beb4 in _PyEval_EvalFrameDefault () #20 0x0000000000507be4 in ?? () #21 0x0000000000509900 in ?? () ---Type <return> to continue, or q <return> to quit--- #22 0x000000000050a2fd in ?? () #23 0x000000000050beb4 in _PyEval_EvalFrameDefault () #24 0x0000000000507be4 in ?? () #25 0x000000000050ad03 in PyEval_EvalCode () #26 0x0000000000634e72 in ?? () #27 0x0000000000634f27 in PyRun_FileExFlags () #28 0x00000000006386df in PyRun_SimpleFileExFlags () #29 0x0000000000639281 in Py_Main () #30 0x00000000004b0dc0 in main () (gdb)
Attachments
Issue Links
- links to