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

[C++] AdaptiveIntBuilder::length() does not consider pending_pos_.

    XMLWordPrintableJSON

Details

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

    Description

      arrow::AdaptiveIntBuilder builder(arrow::default_memory_pool());
      builder.Append(1);
      std::cout << builder.length() << std::endl;
      

      Expected output: 1
      Actual output: 0

      I imagine this regression came with https://github.com/apache/arrow/pull/3040

      My use case: I'm building a JSON parser that appends "records" (JSON Objects mapping key=>value) to Arrow columns (each key gets an ArrayBuilder). Not all JSON Objects contain all keys; so builder.Append() isn't always called. So on a subsequent row, I want to add nulls for every append that was skipped: builder.AppendNulls(row - builder.length()); builder.Append(value). This fails because builder.length() is wrong.

      Annoying but simple workaround: I maintain a separate length value alongside builder.

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              adamhooper Adam Hooper
              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 20m
                  1h 20m