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

   ### Describe the enhancement requested
   
   In certain use cases it's quite useful to convert a `RecordBatch` or a 
`Table` to an array of hashes, e.g. when using Parquet for data exchange. 
Pyarrow provides this functionality as 
[to_pylist](https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table.to_pylist)
 function.
   
   Basically I'd love to see an inverse of `Arrow::RecordBatchBuilder.build`.
   ```ruby
   rb = Arrow::RecordBatchBuilder.build(schema, data)
   assert rb.to_pylist == data
   ```
   
   Additionally it would be great if it correctly handled struct and list data 
type, for example:
   ```ruby
   schema = Arrow::Schema.new([
     Arrow::Field.new("c1", :int32),
     Arrow::Field.new("c2",
       Arrow::StructDataType.new([
         Arrow::Field.new("c3", :int32),
         Arrow::Field.new("c4",
           Arrow::StructDataType.new([
             Arrow::Field.new("c5", :int32),
             Arrow::Field.new("c6", Arrow::ListDataType.new(:int32)),
           ])
         )
       ])
     )
   ])
   
   data = [
       {c1: 1, c2: {c3: 3, c4: {c5: 5, c6: [6, 7]}}},
       {c1: 11, c2: {c3: 13, c4: {c5: 15, c6: [16, 17]}}},
   ]
   rb = Arrow::RecordBatchBuilder.build(schema, data)
   assert rb.to_pylist == data
   ```
   
   (Obviously the method wouldn't be named `to_pylist`.)
   
   ### 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