John Jenkins created ARROW-7985:
-----------------------------------

             Summary: [C++] ListBuilder.Finish fails if underlying value 
builder is empty and .Reserve'd
                 Key: ARROW-7985
                 URL: https://issues.apache.org/jira/browse/ARROW-7985
             Project: Apache Arrow
          Issue Type: Bug
    Affects Versions: 0.15.1
            Reporter: John Jenkins


Here's a reproduction:
{code:java}
#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;
        }
}
{code}
The output is
{noformat}
Invalid: Resize cannot downsize{noformat}
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?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to