MCPcopy Create free account
hub / github.com/apache/arrow-rs / verify_split

Function verify_split

arrow-flight/src/encode.rs:1883–1901  ·  view source on GitHub ↗

Creates a UInt64Array of 8 byte integers with input_rows rows `max_flight_data_size_bytes` pieces and verifies the row counts in those pieces

(
        num_input_rows: u64,
        max_flight_data_size_bytes: usize,
        expected_sizes: Vec<usize>,
    )

Source from the content-addressed store, hash-verified

1881 /// `max_flight_data_size_bytes` pieces and verifies the row counts in
1882 /// those pieces
1883 fn verify_split(
1884 num_input_rows: u64,
1885 max_flight_data_size_bytes: usize,
1886 expected_sizes: Vec<usize>,
1887 ) {
1888 let array: UInt64Array = (0..num_input_rows).collect();
1889
1890 let batch = RecordBatch::try_from_iter(vec![("a", Arc::new(array) as ArrayRef)])
1891 .expect("cannot create record batch");
1892
1893 let input_rows = batch.num_rows();
1894
1895 let split = split_batch_for_grpc_response(batch.clone(), max_flight_data_size_bytes);
1896 let sizes: Vec<_> = split.iter().map(RecordBatch::num_rows).collect();
1897 let output_rows: usize = sizes.iter().sum();
1898
1899 assert_eq!(sizes, expected_sizes, "mismatch for {batch:?}");
1900 assert_eq!(input_rows, output_rows, "mismatch for {batch:?}");
1901 }
1902
1903 // test sending record batches
1904 // test sending record batches with multiple different dictionaries

Calls 5

collectMethod · 0.80
num_rowsMethod · 0.45
cloneMethod · 0.45
iterMethod · 0.45

Tested by 1