This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new aee26284f minor: clarify docstring on `DictionaryArray::lookup_key`
(#1910)
aee26284f is described below
commit aee26284f07ff9af1f2730427a8eb4959bfdec55
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Jun 21 07:23:17 2022 -0400
minor: clarify docstring on `DictionaryArray::lookup_key` (#1910)
* minor: clarify docstring on `DictionaryArray::lookup_key`
* Update arrow/src/array/array_dictionary.rs
Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Liang-Chi Hsieh <[email protected]>
---
arrow/src/array/array_dictionary.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arrow/src/array/array_dictionary.rs
b/arrow/src/array/array_dictionary.rs
index b9da60ccf..cff3daabb 100644
--- a/arrow/src/array/array_dictionary.rs
+++ b/arrow/src/array/array_dictionary.rs
@@ -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();