From a5181b5eb5006128217cbb70983244d4e13fa5f8 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Sat, 22 Jun 2024 21:25:41 -0300 Subject: [PATCH] scalar_cast_test.cc: Include string and binary-views types in cast-checking loop --- .../arrow/compute/kernels/scalar_cast_test.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/cpp/src/arrow/compute/kernels/scalar_cast_test.cc b/cpp/src/arrow/compute/kernels/scalar_cast_test.cc index 4ca8b97ffc45d..3fe9c48e536e2 100644 --- a/cpp/src/arrow/compute/kernels/scalar_cast_test.cc +++ b/cpp/src/arrow/compute/kernels/scalar_cast_test.cc @@ -201,10 +201,12 @@ TEST(Cast, CanCast) { ExpectCannotCast(from_numeric, {null()}); } - for (auto from_base_binary : kBaseBinaryTypes) { + for (auto from_base_binary : kBaseBinaryAndViewTypes) { ExpectCanCast(from_base_binary, {boolean()}); ExpectCanCast(from_base_binary, kNumericTypes); ExpectCanCast(from_base_binary, kBaseBinaryTypes); + // XXX: add float16 to kNumericTypes + ExpectCanCast(from_base_binary, {float16()}); ExpectCanCast(dictionary(int64(), from_base_binary), {from_base_binary}); // any cast which is valid for the dictionary is valid for the DictionaryArray @@ -213,21 +215,6 @@ TEST(Cast, CanCast) { ExpectCannotCast(from_base_binary, {null()}); } - // XXX: include utf8_view() on the list above once all of these pass - for (auto view_ty : {utf8_view(), binary_view()}) { - ExpectCanCast(view_ty, {boolean()}); - ExpectCanCast(view_ty, kNumericTypes); - ExpectCanCast(view_ty, kBaseBinaryTypes); - // XXX: add float16 to kNumericTypes - ExpectCanCast(view_ty, {float16()}); - ExpectCanCast(dictionary(int64(), view_ty), {view_ty}); - - // any cast which is valid for the dictionary is valid for the DictionaryArray - ExpectCanCast(dictionary(uint32(), view_ty), kBaseBinaryTypes); - ExpectCanCast(dictionary(int16(), view_ty), kNumericTypes); - - ExpectCannotCast(view_ty, {null()}); - } ExpectCanCast(utf8(), {timestamp(TimeUnit::MILLI), date32(), date64()}); ExpectCanCast(large_utf8(), {timestamp(TimeUnit::NANO), date32(), date64()});