This is an automated email from the ASF dual-hosted git repository. comphead pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push: new d83a290d1d minor: make dict_from_values public (#17376) d83a290d1d is described below commit d83a290d1d534f7db9849b11c39d2b0a289a62e4 Author: Parth Chandra <par...@apache.org> AuthorDate: Wed Sep 3 19:46:08 2025 -0700 minor: make dict_from_values public (#17376) * minor: make dict_from_values public * Update datafusion/common/src/scalar/mod.rs Co-authored-by: Oleks V <comph...@users.noreply.github.com> * fix format * one more format --------- Co-authored-by: Oleks V <comph...@users.noreply.github.com> --- datafusion/common/src/scalar/mod.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/datafusion/common/src/scalar/mod.rs b/datafusion/common/src/scalar/mod.rs index f1b6b8385e..4d88f5a667 100644 --- a/datafusion/common/src/scalar/mod.rs +++ b/datafusion/common/src/scalar/mod.rs @@ -881,8 +881,21 @@ fn dict_from_scalar<K: ArrowDictionaryKeyType>( )) } -/// Create a dictionary array representing all the values in values -fn dict_from_values<K: ArrowDictionaryKeyType>( +/// Create a `DictionaryArray` from the provided values array. +/// +/// Each element gets a unique key (`0..N-1`), without deduplication. +/// Useful for wrapping arrays in dictionary form. +/// +/// # Input +/// ["alice", "bob", "alice", null, "carol"] +/// +/// # Output +/// `DictionaryArray<Int32>` +/// { +/// keys: [0, 1, 2, 3, 4], +/// values: ["alice", "bob", "alice", null, "carol"] +/// } +pub fn dict_from_values<K: ArrowDictionaryKeyType>( values_array: ArrayRef, ) -> Result<ArrayRef> { // Create a key array with `size` elements of 0..array_len for all --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@datafusion.apache.org For additional commands, e-mail: commits-h...@datafusion.apache.org