Skip to content

Commit

Permalink
minor: clarify docstring on DictionaryArray::lookup_key (#1910)
Browse files Browse the repository at this point in the history
* minor: clarify docstring on `DictionaryArray::lookup_key`

* Update arrow/src/array/array_dictionary.rs

Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>

Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
  • Loading branch information
alamb and viirya committed Jun 21, 2022
1 parent 12ac5c7 commit aee2628
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arrow/src/array/array_dictionary.rs
Expand Up @@ -128,7 +128,11 @@ impl<'a, K: ArrowPrimitiveType> DictionaryArray<K> {
&self.keys
}

/// Returns the lookup key by doing reverse dictionary lookup
/// If `value` is present in `values` (aka the dictionary),
/// returns the corresponding key (index into the `values`
/// array). Otherwise returns `None`.
///
/// Panics if `values` is not a [`StringArray`].
pub fn lookup_key(&self, value: &str) -> Option<K::Native> {
let rd_buf: &StringArray =
self.values.as_any().downcast_ref::<StringArray>().unwrap();
Expand Down

0 comments on commit aee2628

Please sign in to comment.