You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2022/10/11 09:46:00 UTC

[jira] [Commented] (ARROW-17963) [C++] Implement cast_dictionary for string

    [ https://issues.apache.org/jira/browse/ARROW-17963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17615643#comment-17615643 ] 

Joris Van den Bossche commented on ARROW-17963:
-----------------------------------------------

Note that this is true for all types (except dictionary->dictionary), and not just for string. We implemented the dictionary->any type cast ("unpacking" the dictionary) in {{AddCommonCasts}}, but not the other way around. This would basically be doing a "dictionary_encode" (but being able to do that as a cast instead of having to call this kernel explicitly).

The current {{cast_dictionary}}  only covers dictionary -> dictionary casts.

> [C++] Implement cast_dictionary for string
> ------------------------------------------
>
>                 Key: ARROW-17963
>                 URL: https://issues.apache.org/jira/browse/ARROW-17963
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Will Jones
>            Priority: Major
>              Labels: Kernels
>             Fix For: 11.0.0
>
>
> We can cast dictionary(string, X) to string, but not the other way around.
> {code:R}
> > Array$create(c("a", "b"))$cast(dictionary(int32(), string()))
> Error: NotImplemented: Unsupported cast from string to dictionary using function cast_dictionary
> /Users/willjones/Documents/arrows/arrow/cpp/src/arrow/compute/function.cc:249  func.DispatchBest(&in_types)
> > Array$create(as.factor(c("a", "b")))$cast(string())
> Array
> <string>
> [
>   "a",
>   "b"
> ]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)