| 51 | }; |
| 52 | |
| 53 | TEST_F(TryExprTest, tryExpr) { |
| 54 | auto a = makeFlatVector<int32_t>({10, 20, 30, 20, 50, 30}); |
| 55 | auto b = makeFlatVector<int32_t>({1, 0, 3, 4, 0, 6}); |
| 56 | { |
| 57 | auto result = evaluate("try(c0 / c1)", makeRowVector({a, b})); |
| 58 | |
| 59 | auto expectedResult = makeNullableFlatVector<int32_t>( |
| 60 | {10, std::nullopt, 10, 5, std::nullopt, 5}); |
| 61 | assertEqualVectors(expectedResult, result); |
| 62 | } |
| 63 | |
| 64 | auto c = makeNullableFlatVector<StringView>({"1", "2x", "3", "4", "5y"}); |
| 65 | { |
| 66 | auto result = evaluate("try(cast(c0 as integer))", makeRowVector({c})); |
| 67 | auto expectedResult = |
| 68 | makeNullableFlatVector<int32_t>({1, std::nullopt, 3, 4, std::nullopt}); |
| 69 | assertEqualVectors(expectedResult, result); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // Returns the number of times this function has been called so far. |
| 74 | template <typename T> |
nothing calls this directly
no test coverage detected