Skip to content

Commit

Permalink
FIX: Don't say dictionary<string_view> casts are supported yet
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrv committed Jul 21, 2024
1 parent 3c6ad11 commit 7d5a377
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cpp/src/arrow/compute/kernels/scalar_cast_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ void AddZeroCopyCast(Type::type in_type_id, InputType in_type, OutputType out_ty
}

static bool CanCastFromDictionary(Type::type type_id) {
/// TODO(GH-43010): add is_binary_view_like() here once array_take
/// can handle string-views
return (is_primitive(type_id) || is_base_binary_like(type_id) ||
is_fixed_size_binary(type_id) || is_binary_view_like(type_id));
is_fixed_size_binary(type_id));
}

void AddCommonCasts(Type::type out_type_id, OutputType out_ty, CastFunction* func) {
Expand Down
6 changes: 5 additions & 1 deletion cpp/src/arrow/compute/kernels/scalar_cast_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ TEST(Cast, CanCast) {
ExpectCanCast(from_base_binary, {boolean()});
ExpectCanCast(from_base_binary, kNumericTypes);
ExpectCanCast(from_base_binary, kBaseBinaryTypes);
ExpectCanCast(dictionary(int64(), from_base_binary), {from_base_binary});
/// TODO(GH-43010): include is_binary_view_like() types here once array_take
/// can handle string-views
if (!is_binary_view_like(*from_base_binary)) {
ExpectCanCast(dictionary(int64(), from_base_binary), {from_base_binary});
}

// any cast which is valid for the dictionary is valid for the DictionaryArray
ExpectCanCast(dictionary(uint32(), from_base_binary), kBaseBinaryTypes);
Expand Down

0 comments on commit 7d5a377

Please sign in to comment.