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

[Python] Slice methods should return empty arrays instead of crashing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.1
    • 2.0.0
    • Python

    Description

      This crashes because of a CHECK assert. However, it's surprising to Python users who would expect an empty slice, or at least an exception.

      >>> import pyarrow as pa
      >>> table = pa.table([[1,2,3], [4,5,6]], names=["a", "b"])
      >>> table.slice(4, 5)
      /arrow/cpp/src/arrow/chunked_array.cc:122:  Check failed: (offset) <= (length_) Slice offset greater than array length
      /home/lidavidm/Code/twosigma/arrow/venv2/lib/python3.8/site-packages/pyarrow/libarrow.so.200(+0x550e68)[0x7fe2dead1e68]
      /home/lidavidm/Code/twosigma/arrow/venv2/lib/python3.8/site-packages/pyarrow/libarrow.so.200(_ZN5arrow4util8ArrowLogD1Ev+0xdd)[0x7fe2dead27dd]
      /home/lidavidm/Code/twosigma/arrow/venv2/lib/python3.8/site-packages/pyarrow/libarrow.so.200(_ZNK5arrow12ChunkedArray5SliceEll+0x634)[0x7fe2debdfdd4]
      /home/lidavidm/Code/twosigma/arrow/venv2/lib/python3.8/site-packages/pyarrow/libarrow.so.200(_ZNK5arrow11SimpleTable5SliceEll+0x64)[0x7fe2deb798e4]
      /home/lidavidm/Code/twosigma/arrow/venv2/lib/python3.8/site-packages/pyarrow/lib.cpython-38-x86_64-linux-gnu.so(+0x168425)[0x7fe2dfb5a425]
      /usr/lib/libpython3.8.so.1.0(+0x130ed5)[0x7fe2e08feed5]
      /usr/lib/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x761)[0x7fe2e08ecac1]
      /usr/lib/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x304)[0x7fe2e08eb044]
      /usr/lib/libpython3.8.so.1.0(PyEval_EvalCode+0x23)[0x7fe2e099c3a3]
      /usr/lib/libpython3.8.so.1.0(+0x1d9c18)[0x7fe2e09a7c18]
      /usr/lib/libpython3.8.so.1.0(+0x1d3e33)[0x7fe2e09a1e33]
      /usr/lib/libpython3.8.so.1.0(+0x10151a)[0x7fe2e08cf51a]
      /usr/lib/libpython3.8.so.1.0(PyRun_InteractiveLoopFlags+0xee)[0x7fe2e08d07ff]
      /usr/lib/libpython3.8.so.1.0(PyRun_AnyFileExFlags+0x3e)[0x7fe2e086b08e]
      /usr/lib/libpython3.8.so.1.0(+0x89ca3)[0x7fe2e0857ca3]
      /usr/lib/libpython3.8.so.1.0(Py_BytesMain+0x39)[0x7fe2e0990c59]
      /usr/lib/libc.so.6(__libc_start_main+0xf2)[0x7fe2e062d152]
      python(_start+0x2e)[0x5611f54b104e]
       

      Attachments

        Issue Links

          Activity

            People

              lidavidm David Li
              lidavidm David Li
              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 - 1h 40m
                  1h 40m