lidavidm commented on a change in pull request #10721:
URL: https://github.com/apache/arrow/pull/10721#discussion_r670575574
##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_test.cc
##########
@@ -1931,14 +1931,29 @@ TEST(Cast, DictTypeToAnotherDict) {
R"(["a", "b", "a", null])");
auto arr = ArrayFromJSON(dictionary(int32(), int32()), "[1, 1000]");
- // check unsafe
+ // check unsafe values
ASSERT_OK_AND_ASSIGN(auto casted,
Cast(arr, dictionary(int8(), int8()),
CastOptions::Unsafe()));
ValidateOutput(casted);
- // check safe
+ // check safe values
EXPECT_RAISES_WITH_MESSAGE_THAT(
Invalid, testing::HasSubstr("Integer value 1000 not in range"),
Cast(arr, dictionary(int8(), int8()), CastOptions::Safe()));
+
+ // check unsafe indices
+ random::RandomArrayGenerator rand(/*seed=*/0);
+ int64_t len = 1000;
+ auto val_arr = rand.ArrayOf(int32(), len, /*null_probability=*/0.01);
+ ASSERT_OK_AND_ASSIGN(auto arr2, DictionaryEncode(val_arr));
+ // check unsafe indices. Cannot validate this array because ValidateOutput
throws an
Review comment:
It looks like it does - are you saying it shouldn't?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]