bkietz commented on code in PR #14402:
URL: https://github.com/apache/arrow/pull/14402#discussion_r994898370
##########
cpp/src/arrow/engine/substrait/serde_test.cc:
##########
@@ -402,22 +402,36 @@ TEST(Substrait, SupportedLiterals) {
auto ExpectEq = [](std::string_view json, Datum expected_value) {
ARROW_SCOPED_TRACE(json);
- ASSERT_OK_AND_ASSIGN(
- auto buf, internal::SubstraitFromJSON("Expression",
- "{\"literal\":" +
std::string(json) + "}"));
- ExtensionSet ext_set;
- ASSERT_OK_AND_ASSIGN(auto expr, DeserializeExpression(*buf, ext_set));
+ for (bool nullable : {false, true}) {
+ std::string json_with_nullable;
+ std::string nullable_json = (nullable) ? ", \"nullable\": true" : "";
+ if (nullable) {
+ auto final_closing_brace = json.find_last_of('}');
+ ASSERT_NE(std::string_view::npos, final_closing_brace);
+ json_with_nullable =
+ std::string(json.substr(0, final_closing_brace)) + ",
\"nullable\": true}";
+ json = json_with_nullable;
+ }
Review Comment:
I see ignoring unknown fields was added in #13605 since the json conversion
is being used in more places. This should probably be an argument to
`SubstraitFromJSON` instead, so that we can be stricter while testing.
--
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]