| 254 | } |
| 255 | |
| 256 | fn set_dict( |
| 257 | &mut self, |
| 258 | buf: Bytes, |
| 259 | num_values: u32, |
| 260 | encoding: Encoding, |
| 261 | _is_sorted: bool, |
| 262 | ) -> Result<()> { |
| 263 | if !matches!( |
| 264 | encoding, |
| 265 | Encoding::PLAIN | Encoding::RLE_DICTIONARY | Encoding::PLAIN_DICTIONARY |
| 266 | ) { |
| 267 | return Err(nyi_err!( |
| 268 | "Invalid/Unsupported encoding type for dictionary: {}", |
| 269 | encoding |
| 270 | )); |
| 271 | } |
| 272 | |
| 273 | if K::from_usize(num_values as usize).is_none() { |
| 274 | return Err(general_err!("dictionary too large for index type")); |
| 275 | } |
| 276 | |
| 277 | let len = num_values as usize; |
| 278 | let mut buffer = OffsetBuffer::<V>::with_capacity(0); |
| 279 | let mut decoder = ByteArrayDecoderPlain::new(buf, len, Some(len), self.validate_utf8); |
| 280 | decoder.read(&mut buffer, usize::MAX)?; |
| 281 | |
| 282 | let array = buffer.into_array(None, self.value_type.clone()); |
| 283 | self.dict = Some(array); |
| 284 | Ok(()) |
| 285 | } |
| 286 | |
| 287 | fn set_data( |
| 288 | &mut self, |