Helper to extract (code, value) rows from batches.
(batches: &[RecordBatch])
| 2020 | |
| 2021 | /// Helper to extract (code, value) rows from batches. |
| 2022 | fn 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] |
no test coverage detected