Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
asfimport opened this issue Mar 2, 2020 · 2 comments
Assignees
Milestone

Comments

@asfimport
Copy link
Collaborator

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?

Reporter: John Jenkins / @JohnPJenkins
Assignee: Antoine Pitrou / @pitrou

PRs and other links:

Note: This issue was originally created as ARROW-7985. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Antoine Pitrou / @pitrou:
Thanks for the report! Your suggestion is correct, I'll submit a PR.

@asfimport
Copy link
Collaborator Author

Ben Kietzman / @bkietz:
Issue resolved by pull request 6595
#6595

@asfimport asfimport added this to the 0.17.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants