MCPcopy Create free account
hub / github.com/apache/arrow / CheckListCastError

Function CheckListCastError

cpp/src/arrow/scalar_test.cc:1383–1401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1381
1382template <typename ScalarType>
1383void CheckListCastError(const ScalarType& scalar,
1384 const std::shared_ptr<DataType>& to_type) {
1385 StatusCode code;
1386 std::string expected_message;
1387 if (scalar.type->id() == Type::FIXED_SIZE_LIST) {
1388 code = StatusCode::TypeError;
1389 expected_message =
1390 "Size of FixedSizeList is not the same. input list: " + scalar.type->ToString() +
1391 " output list: " + to_type->ToString();
1392 } else {
1393 code = StatusCode::Invalid;
1394 expected_message =
1395 "ListType can only be casted to FixedSizeListType if the lists are all the "
1396 "expected size.";
1397 }
1398
1399 EXPECT_RAISES_WITH_CODE_AND_MESSAGE_THAT(code, ::testing::HasSubstr(expected_message),
1400 Cast(scalar, to_type));
1401}
1402
1403template <typename T>
1404class TestListLikeScalar : public ::testing::Test {

Callers 2

TestCastMethod · 0.85
TESTFunction · 0.85

Calls 3

CastFunction · 0.85
idMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected