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

Method set_data

parquet/src/arrow/array_reader/byte_array_dictionary.rs:287–315  ·  view source on GitHub ↗
(
        &mut self,
        encoding: Encoding,
        data: Bytes,
        num_levels: usize,
        num_values: Option<usize>,
    )

Source from the content-addressed store, hash-verified

285 }
286
287 fn set_data(
288 &mut self,
289 encoding: Encoding,
290 data: Bytes,
291 num_levels: usize,
292 num_values: Option<usize>,
293 ) -> Result<()> {
294 let decoder = match encoding {
295 Encoding::RLE_DICTIONARY | Encoding::PLAIN_DICTIONARY => {
296 let bit_width = data[0];
297 let mut decoder = RleDecoder::new(bit_width);
298 decoder.set_data(data.slice(1..))?;
299 MaybeDictionaryDecoder::Dict {
300 decoder,
301 max_remaining_values: num_values.unwrap_or(num_levels),
302 }
303 }
304 _ => MaybeDictionaryDecoder::Fallback(ByteArrayDecoder::new(
305 encoding,
306 data,
307 num_levels,
308 num_values,
309 self.validate_utf8,
310 )?),
311 };
312
313 self.decoder = Some(decoder);
314 Ok(())
315 }
316
317 fn read(&mut self, out: &mut Self::Buffer, num_values: usize) -> Result<usize> {
318 match self.decoder.as_mut().expect("decoder set") {

Callers 5

test_dictionary_fallbackFunction · 0.45
test_nullsFunction · 0.45

Calls 1

sliceMethod · 0.45

Tested by 5

test_dictionary_fallbackFunction · 0.36
test_nullsFunction · 0.36