edponce commented on a change in pull request #10721: URL: https://github.com/apache/arrow/pull/10721#discussion_r671501863
########## File path: cpp/src/arrow/compute/kernels/scalar_cast_test.cc ########## @@ -1911,5 +1911,50 @@ TEST(Cast, ExtensionTypeToIntDowncast) { } } +TEST(Cast, DictTypeToAnotherDict) { + auto check_cast = [&](const std::shared_ptr<DataType>& in_type, + const std::shared_ptr<DataType>& out_type, + const std::string& json_str, + const CastOptions& options = CastOptions()) { + auto arr = ArrayFromJSON(in_type, json_str); + auto exp = in_type->Equals(out_type) ? arr : ArrayFromJSON(out_type, json_str); + // this checks for scalars as well + CheckCast(arr, exp, options); + }; + + // check same type passed on to casting + check_cast(dictionary(int8(), int16()), dictionary(int8(), int16()), + "[1, 2, 3, 1, null, 3]"); + check_cast(dictionary(int8(), int16()), dictionary(int32(), int64()), + "[1, 2, 3, 1, null, 3]"); + check_cast(dictionary(int32(), utf8()), dictionary(int8(), utf8()), + R"(["a", "b", "a", null])"); + Review comment: I tested ``` check_cast(dictionary(int32(), int32()), dictionary(int64(), float32()), "[1, 2, 3, 1, null, 3]"); ``` and get the following error: `NotImplemented: JSON conversion to dictionary<values=float, indices=int8, ordered=0> not implemented` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org