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

[C++][Python] Crashes and incorrect results when converting large integers to dates

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 6.0.0, 5.0.1
    • C++, Python
    • OS: Windows 10 Pro (Version 20H2)
      CPU: AMD Ryzen 5 1600 Six-Core Processor 3.20 GHz
      Python: 3.8.8 AMD64
      pyarrow is latest version installed with pip

    Description

      Running this code snippet will cause a crash. This happens for a range of numbers around this one as well:

       

      import pyarrow
      date = pyarrow.array([-1448879500], pyarrow.date32())
      print(date)
      

      I don't know where this crash is coming from, so it might be in the C++ code rather than the Python bindings.

      For other extreme numbers you get the wrong result. It looks like something is overflowing. Here is the input and result for a few different examples:

      • -2000000000 -> 31179-12-27
      • -1000000000 -> 16574-12-29
      • 2000000000 -> -27240-01-06
      • 1000000000 -> -12635-01-03

      I would prefer if these gave errors rather than silently overflowing.

       

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              Tim638 Tim Evans
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 3h 20m
                  3h 20m