dmitry-chirkov-dremio commented on code in PR #54910:
URL: https://github.com/apache/arrow/pull/54910#discussion_r4349446198
##########
cpp/src/arrow/engine/substrait/serde_test.cc:
##########
@@ -1581,6 +1582,22 @@ TEST(Substrait, InvalidEmptyExtensionDeclaration) {
ASSERT_RAISES(Invalid, DeserializePlans(*buf, [] { return kNullConsumer; }));
}
+TEST(Substrait, InvalidDecimalPrecisionReturnsStatus) {
+ // GH-50230: a decimal precision outside [1, 38] must produce an error rather
+ // than aborting the process in the Decimal128Type constructor.
+ constexpr std::string_view kPocBase64 =
+
"GswBCskBCsYBEr4BCgJjMAoCYzEKAmMyCgJjMwoCYzQKAmM1CgJjNgoCYzcKAmM4CgJjOQoDYzEw"
+
"CgNjMTEKA2MxMgoDYzEzCgNjMTQKA2MxNQoDYzE2CgNjMTcSbAoCCgAKAhIACgIaAAoCKgAKAjoA"
+
"CgJSAAoCWgAKAmIACgJqAAoCcgAKA4IBAAoDigEACgfCAQQIAhAqCgWqAQIIBAoFsgECCAgKB9oB"
+ "BAoCOgAKC+IBCAoCYgASAjoACgvKAQgKAioACgJiADoDCgF0MgsQLCoHbzItc2VlZA==";
+ ASSERT_OK_AND_ASSIGN(auto poc, util::base64_decode(kPocBase64));
+ ASSERT_EQ(poc.size(), 220);
+
+ EXPECT_THAT(DeserializePlan(*Buffer::FromString(std::move(poc)),
+ /*registry=*/nullptr, /*ext_set_out=*/nullptr),
+ Raises(StatusCode::Invalid, HasSubstr("Decimal precision out of
range")));
Review Comment:
Let's do a "classic" boundary check tests with 0, 1, 38, or 39, please?
--
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]