You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fpacanowski
changed the title
RecordBatchBuilder doesn't work with list of structs.
[Ruby] RecordBatchBuilder doesn't work with list of structs.
Dec 3, 2024
kou
changed the title
[Ruby] RecordBatchBuilder doesn't work with list of structs.
[Ruby] RecordBatchBuilder doesn't work with list of structs
Dec 4, 2024
kou
added a commit
to kou/arrow
that referenced
this issue
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:
```ruby
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.
* GitHub Issue: #44918
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
Describe the bug, including details regarding any error messages, version, and platform.
RecordBatchBuilder
doesn't seem to correctly handle a schema that contains a list of structs. Here's a minimal test case:Table should have 2 rows, but it's empty (tested on HEAD).
I've also checked that equivalent code in PyArrow works correctly (the table has two rows):
Related bug report: #44742.
Component(s)
Ruby
The text was updated successfully, but these errors were encountered: