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

Function extract_code_value

crates/integration_tests/tests/read_tables.rs:2022–2039  ·  view source on GitHub ↗

Helper to extract (code, value) rows from batches.

(batches: &[RecordBatch])

Source from the content-addressed store, hash-verified

2020
2021/// Helper to extract (code, value) rows from batches.
2022fn extract_code_value(batches: &[RecordBatch]) -> Vec<(String, i32)> {
2023 let mut rows = Vec::new();
2024 for batch in batches {
2025 let code = batch
2026 .column_by_name("code")
2027 .and_then(|c| c.as_any().downcast_ref::<StringArray>())
2028 .expect("code");
2029 let value = batch
2030 .column_by_name("value")
2031 .and_then(|c| c.as_any().downcast_ref::<Int32Array>())
2032 .expect("value");
2033 for i in 0..batch.num_rows() {
2034 rows.push((code.value(i).to_string(), value.value(i)));
2035 }
2036 }
2037 rows.sort_by(|a, b| a.0.cmp(&b.0));
2038 rows
2039}
2040
2041/// Bucket predicate filtering with short string keys (<=7 bytes, inline encoding).
2042#[tokio::test]

Calls 3

num_rowsMethod · 0.80
cmpMethod · 0.80
as_anyMethod · 0.45

Tested by

no test coverage detected