Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-11673

[C++] Casting dictionary type to use different index type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0
    • C++

    Description

      It's currently not implemented to cast from one dictionary type to another dictionary type to change the index type.

      Small example:

      In [2]: arr = pa.array(['a', 'b', 'a']).dictionary_encode()
      
      In [3]: arr.type
      Out[3]: DictionaryType(dictionary<values=string, indices=int32, ordered=0>)
      
      In [5]: arr.cast(pa.dictionary(pa.int8(), pa.string()))
      ...
      ArrowNotImplementedError: Unsupported cast from dictionary<values=string, indices=int32, ordered=0> to dictionary<values=string, indices=int8, ordered=0> (no available cast function for target type)
      ../src/arrow/compute/cast.cc:112  GetCastFunctionInternal(cast_options->to_type, args[0].type().get())
      

      From https://stackoverflow.com/questions/66223730/how-to-change-column-datatype-with-pyarrow

      Attachments

        Issue Links

          Activity

            People

              niranda Niranda Perera
              jorisvandenbossche Joris Van den Bossche
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 7.5h
                  7.5h