fpacanowski commented on issue #44742:
URL: https://github.com/apache/arrow/issues/44742#issuecomment-2508988375

   @kou Thanks for working on this. Unfortunately, as far as I can tell, the 
fix in https://github.com/apache/arrow/pull/44763 is **not** correct. The code 
no longer crashes, but the table built is not correct. 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")
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to