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

Function test_write_multiple_batches

crates/paimon/src/table/table_write.rs:1083–1107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1081
1082 #[tokio::test]
1083 async fn test_write_multiple_batches() {
1084 let file_io = test_file_io();
1085 let table_path = "memory:/test_table_write_multi";
1086 setup_dirs(&file_io, table_path).await;
1087
1088 let table = test_table(&file_io, table_path);
1089 let mut table_write = TableWrite::new(&table, "test-user".to_string()).unwrap();
1090
1091 table_write
1092 .write_arrow_batch(&make_batch(vec![1, 2], vec![10, 20]))
1093 .await
1094 .unwrap();
1095 table_write
1096 .write_arrow_batch(&make_batch(vec![3, 4], vec![30, 40]))
1097 .await
1098 .unwrap();
1099
1100 let messages = table_write.prepare_commit().await.unwrap();
1101 assert_eq!(messages.len(), 1);
1102 // Multiple batches accumulate into a single file
1103 assert_eq!(messages[0].new_files.len(), 1);
1104
1105 let total_rows: i64 = messages[0].new_files.iter().map(|f| f.row_count).sum();
1106 assert_eq!(total_rows, 4);
1107 }
1108
1109 fn test_bucketed_schema() -> TableSchema {
1110 let schema = Schema::builder()

Callers

nothing calls this directly

Calls 7

write_arrow_batchMethod · 0.80
test_file_ioFunction · 0.70
setup_dirsFunction · 0.70
test_tableFunction · 0.70
make_batchFunction · 0.70
prepare_commitMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected