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

GH-44918: [Ruby] Fix a bug that empty list is ignored in builder #44933

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

kou
Copy link
Member

@kou kou commented Dec 4, 2024

Rationale for this change

Arrow::ListArrayBuilder#append_value with [] must append an empty list as an element. In general, it works but it doesn't work when list item is struct or list. Because Arrow::{List,Struct}ArrayBuilder#append without arguments appends an element. It's for a backward compatibility. But it has a problem for this case.

For example, the following case has this problem:

item_type = Arrow::StructDataType.new([{name: "visible", type: :boolean}])
data_type = Arrow::ListDataType.new(name: "struct", data_type: item_type)
builder = Arrow::ListArrayBuilder.new(data_type)
builder.append_value([])
array = builder.finish
array.to_a # => must be [[]] but [] without this change

What changes are included in this PR?

This should be fixed by GH-44763 but the fix was wrong. This change fixes wrong return if location.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

Copy link

github-actions bot commented Dec 4, 2024

⚠️ GitHub issue #44918 has been automatically assigned in GitHub to PR creator.

@kou
Copy link
Member Author

kou commented Dec 9, 2024

+1

@kou kou merged commit 1416f62 into apache:main Dec 9, 2024
9 checks passed
@kou kou deleted the ruby-record-batch-builder-list branch December 9, 2024 00:27
@kou kou removed the awaiting committer review Awaiting committer review label Dec 9, 2024
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 1416f62.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant