Skip to content

Commit 71c2159

Browse files
authored
return reference from DictionaryArray::values() (apache#313) (apache#314)
Signed-off-by: Raphael Taylor-Davies <[email protected]>
1 parent dde86b9 commit 71c2159

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arrow/src/array/array_dictionary.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ impl<'a, K: ArrowPrimitiveType> DictionaryArray<K> {
101101
.flatten()
102102
}
103103

104-
/// Returns an `ArrayRef` to the dictionary values.
105-
pub fn values(&self) -> ArrayRef {
106-
self.values.clone()
104+
/// Returns a reference to the dictionary values array
105+
pub fn values(&self) -> &ArrayRef {
106+
&self.values
107107
}
108108

109109
/// Returns a clone of the value type of this list.

arrow/src/compute/kernels/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,10 +1371,10 @@ fn dictionary_cast<K: ArrowDictionaryKeyType>(
13711371
})?;
13721372

13731373
let keys_array: ArrayRef = Arc::new(dict_array.keys_array());
1374-
let values_array: ArrayRef = dict_array.values();
1374+
let values_array = dict_array.values();
13751375
let cast_keys = cast_with_options(&keys_array, to_index_type, &cast_options)?;
13761376
let cast_values =
1377-
cast_with_options(&values_array, to_value_type, &cast_options)?;
1377+
cast_with_options(values_array, to_value_type, &cast_options)?;
13781378

13791379
// Failure to cast keys (because they don't fit in the
13801380
// target type) results in NULL values;

arrow/src/compute/kernels/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ mod tests {
10071007
expected_data: Vec<Option<&str>>,
10081008
) {
10091009
let array = DictionaryArray::<T>::from_iter(data.into_iter());
1010-
let array_values = array.values();
1010+
let array_values = array.values().clone();
10111011
let dict = array_values
10121012
.as_any()
10131013
.downcast_ref::<StringArray>()

0 commit comments

Comments
 (0)