fpacanowski opened a new issue, #44918:
URL: https://github.com/apache/arrow/issues/44918

   ### 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:
   ```ruby
   schema = Arrow::Schema.new(
     [
      Arrow::Field.new("structs", Arrow::ListDataType.new(
        Arrow::StructDataType.new([
          Arrow::Field.new("foo", :int64),
          Arrow::Field.new("bar", :int64)
        ])
      ))
    ]
   )
   
   table = Arrow::RecordBatchBuilder.build(schema, [
     { structs: [] },
     { structs: [] },
   ]).to_table
   
   assert_equal(2, table.n_rows)
   ```
   
   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):
   ```python
   import pyarrow as pa
   import pyarrow.parquet as pq
   
   schema = pa.schema(
       [
           pa.field(
               "structs",
               pa.list_(
                   pa.struct([
                       pa.field("foo", pa.int64()),
                       pa.field("bar", pa.int64())
                   ])
               )
           )
       ]
   )
   
   data = [
       {"structs": []},
       {"structs": []}
   ]
   
   table = pa.Table.from_pylist(data, schema=schema)
   print(table.shape)
   
   pq.write_table(table, "file.parquet")
   ```
   
   Related bug report: https://github.com/apache/arrow/issues/44742.
   
   ### Component(s)
   
   Ruby


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to