kou commented on issue #40798:
URL: https://github.com/apache/arrow/issues/40798#issuecomment-2024464767

   How about using `Parquet::ArrowFileWriter#write_table`?
   
   ```ruby
   require "parquet"
   
   schema = Arrow::Schema.new(a: :int64,
                              b: :int64,
                              c: :int64,
                              d: :int64)
   n_total_records = 10000000000
   n_columns = schema.n_fields
   
   n_rows = 4096
   max_int64 = 2 ** 63 - 1
   arrays = n_columns.times.collect do
     Arrow::Int64Array.new(n_rows.times.collect {rand(max_int64)})
   end
   table = Arrow::Table.new(schema, arrays)
   
   Parquet::ArrowFileWriter.open(schema, "output.parquet") do |writer|
     while n_total_records > 0
       writer.write_table(table, 1024 * 1024)
       n_total_records -= table.n_rows
     end
   end
   ```


-- 
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