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

Method with_values

arrow-array/src/array/dictionary_array.rs:477–487  ·  view source on GitHub ↗

Returns a new dictionary with the same keys as the current instance but with a different set of dictionary values This can be used to perform an operation on the values of a dictionary # Panics Panics if `values` has a length less than the current values ``` # use std::sync::Arc; # use arrow_array::builder::PrimitiveDictionaryBuilder; # use arrow_array::{Int8Array, Int64Array, ArrayAccessor};

(&self, values: ArrayRef)

Source from the content-addressed store, hash-verified

475 /// ```
476 ///
477 pub fn with_values(&self, values: ArrayRef) -> Self {
478 assert!(values.len() >= self.values.len());
479 let data_type =
480 DataType::Dictionary(Box::new(K::DATA_TYPE), Box::new(values.data_type().clone()));
481 Self {
482 data_type,
483 keys: self.keys.clone(),
484 values,
485 is_ordered: false,
486 }
487 }
488
489 /// Returns `PrimitiveDictionaryBuilder` of this dictionary array for mutating
490 /// its keys and values if the underlying data buffer is not shared by others.

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected