MCPcopy Create free account
hub / github.com/apache/arrow-rs / set_dict

Method set_dict

parquet/src/arrow/array_reader/byte_array_dictionary.rs:256–285  ·  view source on GitHub ↗
(
        &mut self,
        buf: Bytes,
        num_values: u32,
        encoding: Encoding,
        _is_sorted: bool,
    )

Source from the content-addressed store, hash-verified

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,

Callers 6

test_dictionary_fallbackFunction · 0.45
test_nullsFunction · 0.45

Calls 3

readMethod · 0.45
into_arrayMethod · 0.45
cloneMethod · 0.45

Tested by 6

test_dictionary_fallbackFunction · 0.36
test_nullsFunction · 0.36