(&mut self, tape: &Tape<'_>, pos: &[u32])
| 89 | |
| 90 | impl<O: OffsetSizeTrait> ArrayDecoder for BinaryArrayDecoder<O> { |
| 91 | fn decode(&mut self, tape: &Tape<'_>, pos: &[u32]) -> Result<ArrayRef, ArrowError> { |
| 92 | let data_capacity = estimate_data_capacity(tape, pos)?; |
| 93 | |
| 94 | if O::from_usize(data_capacity).is_none() { |
| 95 | return Err(ArrowError::JsonError(format!( |
| 96 | "offset overflow decoding {}", |
| 97 | GenericStringArray::<O>::DATA_TYPE |
| 98 | ))); |
| 99 | } |
| 100 | |
| 101 | let mut builder = GenericBinaryBuilder::<O>::with_capacity(pos.len(), data_capacity); |
| 102 | |
| 103 | for p in pos { |
| 104 | match tape.get(*p) { |
| 105 | TapeElement::String(idx) => { |
| 106 | let string = tape.get_string(idx); |
| 107 | // Decode directly into the builder for performance. If decoding fails, |
| 108 | // the error is terminal and the builder is discarded by the caller. |
| 109 | decode_hex_to_writer(string, &mut builder)?; |
| 110 | builder.append_value(b""); |
| 111 | } |
| 112 | TapeElement::Null => builder.append_null(), |
| 113 | _ => unreachable!(), |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | Ok(Arc::new(builder.finish())) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | #[derive(Default)] |
nothing calls this directly
no test coverage detected