MCPcopy Create free account
hub / github.com/apache/paimon-rust / write_commit_read

Function write_commit_read

crates/integration_tests/tests/append_tables.rs:128–147  ·  view source on GitHub ↗

Write batches → commit → scan → read, return all batches.

(table: &Table, batches: Vec<RecordBatch>)

Source from the content-addressed store, hash-verified

126
127/// Write batches → commit → scan → read, return all batches.
128async 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)

Calls 12

new_write_builderMethod · 0.80
new_writeMethod · 0.80
write_arrow_batchMethod · 0.80
new_commitMethod · 0.80
new_read_builderMethod · 0.80
planMethod · 0.80
new_scanMethod · 0.80
new_readMethod · 0.80
to_arrowMethod · 0.80
splitsMethod · 0.80
commitMethod · 0.45
prepare_commitMethod · 0.45

Tested by

no test coverage detected