bkietz commented on a change in pull request #10862:
URL: https://github.com/apache/arrow/pull/10862#discussion_r682851194
##########
File path: cpp/src/arrow/scalar_test.cc
##########
@@ -902,6 +1214,37 @@ TEST(TestDictionaryScalar, Basics) {
}
}
+TEST(TestDictionaryScalar, ValidateErrors) {
+ auto index_ty = int16();
+ auto value_ty = utf8();
+ auto dict = ArrayFromJSON(value_ty, R"(["alpha", "beta", "gamma"])");
Review comment:
I'd say `is_valid==true`
##########
File path: cpp/src/arrow/scalar_test.cc
##########
@@ -37,14 +37,52 @@ namespace arrow {
using internal::checked_cast;
using internal::checked_pointer_cast;
+std::shared_ptr<Scalar> CheckMakeNullScalar(const std::shared_ptr<DataType>&
type) {
+ const auto scalar = MakeNullScalar(type);
+ ARROW_EXPECT_OK(scalar->Validate());
+ ARROW_EXPECT_OK(scalar->ValidateFull());
+ AssertTypeEqual(*type, *scalar->type);
+ EXPECT_FALSE(scalar->is_valid);
+ return scalar;
+}
+
+template <typename... MakeScalarArgs>
+void AssertMakeScalar(const Scalar& expected, MakeScalarArgs&&... args) {
+ ASSERT_OK_AND_ASSIGN(auto scalar,
MakeScalar(std::forward<MakeScalarArgs>(args)...));
+ ASSERT_OK(scalar->Validate());
+ ASSERT_OK(scalar->ValidateFull());
+ AssertScalarsEqual(expected, *scalar, /*verbose=*/true);
+}
+
+void AssertParseScalar(const std::shared_ptr<DataType>& type, const
util::string_view& s,
Review comment:
will do
--
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]