Write batches → commit → scan → read, return all batches.
(table: &Table, batches: Vec<RecordBatch>)
| 126 | |
| 127 | /// Write batches → commit → scan → read, return all batches. |
| 128 | async fn write_commit_read(table: &Table, batches: Vec<RecordBatch>) -> Vec<RecordBatch> { |
| 129 | let wb = table.new_write_builder(); |
| 130 | let mut tw = wb.new_write().unwrap(); |
| 131 | for batch in &batches { |
| 132 | tw.write_arrow_batch(batch).await.unwrap(); |
| 133 | } |
| 134 | wb.new_commit() |
| 135 | .commit(tw.prepare_commit().await.unwrap()) |
| 136 | .await |
| 137 | .unwrap(); |
| 138 | |
| 139 | let rb = table.new_read_builder(); |
| 140 | let plan = rb.new_scan().plan().await.unwrap(); |
| 141 | let read = rb.new_read().unwrap(); |
| 142 | read.to_arrow(plan.splits()) |
| 143 | .unwrap() |
| 144 | .try_collect() |
| 145 | .await |
| 146 | .unwrap() |
| 147 | } |
| 148 | |
| 149 | // --------------------------------------------------------------------------- |
| 150 | // Unpartitioned, bucket = -1 (default) |
no test coverage detected