(self, num_batches=5, as_table=False)
| 55 | return self.sink.getvalue() |
| 56 | |
| 57 | def write_batches(self, num_batches=5, as_table=False): |
| 58 | nrows = 5 |
| 59 | schema = pa.schema([('one', pa.float64()), ('two', pa.utf8())]) |
| 60 | |
| 61 | writer = self._get_writer(self.sink, schema) |
| 62 | |
| 63 | batches = [] |
| 64 | for i in range(num_batches): |
| 65 | batch = pa.record_batch( |
| 66 | [[random.random() for _ in range(nrows)], |
| 67 | ['foo', None, 'bar', 'bazbaz', 'qux']], |
| 68 | schema=schema) |
| 69 | batches.append(batch) |
| 70 | |
| 71 | if as_table: |
| 72 | table = pa.Table.from_batches(batches) |
| 73 | writer.write_table(table) |
| 74 | else: |
| 75 | for batch in batches: |
| 76 | writer.write_batch(batch) |
| 77 | |
| 78 | self.write_stats = writer.stats |
| 79 | writer.close() |
| 80 | return batches |
| 81 | |
| 82 | |
| 83 | class FileFormatFixture(IpcFixture): |
no test coverage detected