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)
| 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. |