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

[C++] ListBuilder.Finish fails if underlying value builder is empty and .Reserve'd

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.15.1
    • 0.17.0
    • C++

    Description

      Here's a reproduction:

      #include <arrow/builder.h>
      #include <arrow/status.h>
      #include <iostream>
      
      int main() {
              arrow::ListBuilder lb(arrow::default_memory_pool(), std::unique_ptr<arrow::ArrayBuilder>(new arrow::Int32Builder()));
              lb.value_builder()->Reserve(100); // bug
              lb.Append();
              std::shared_ptr<arrow::Array> ar;
              arrow::Status st = lb.Finish(&ar);
              if (!st.ok()) {
                      std::cerr << st << '\n';
                      return 1;
              }
      }
      

      The output is

      Invalid: Resize cannot downsize

      The Resize call is made at builder_nested.h, line 115. There's a note there about ARROW-2744. Perhaps the fix is to look at capacity rather than length?

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              jjenkins John Jenkins
              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 - 40m
                  40m