Parse a msgpack array payload into individual row slices.
(bytes: &[u8])
| 75 | |
| 76 | /// Parse a msgpack array payload into individual row slices. |
| 77 | fn parse_msgpack_rows(bytes: &[u8]) -> crate::Result<Vec<&[u8]>> { |
| 78 | use nodedb_query::msgpack_scan::reader; |
| 79 | |
| 80 | if bytes.is_empty() { |
| 81 | return Ok(Vec::new()); |
| 82 | } |
| 83 | |
| 84 | let (count, mut pos) = |
| 85 | reader::array_header(bytes, 0).ok_or_else(|| crate::Error::PlanError { |
| 86 | detail: "post-aggregation: invalid msgpack array header".into(), |
| 87 | })?; |
| 88 | |
| 89 | let mut rows = Vec::with_capacity(count); |
| 90 | for _ in 0..count { |
| 91 | let start = pos; |
| 92 | pos = reader::skip_value(bytes, pos).ok_or_else(|| crate::Error::PlanError { |
| 93 | detail: "post-aggregation: truncated msgpack row".into(), |
| 94 | })?; |
| 95 | rows.push(&bytes[start..pos]); |
| 96 | } |
| 97 | Ok(rows) |
| 98 | } |
| 99 | |
| 100 | /// Extract a field value as string from a msgpack map row. |
| 101 | /// Handles "collection.field" suffix matching. |
no test coverage detected