-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-44101: [C++][Parquet] Tools: Debug Print for Json should be valid JSON #44532
Conversation
cpp/src/parquet/reader_test.cc
Outdated
@@ -1172,6 +1180,30 @@ TEST_F(TestJSONWithLocalFile, JSONOutputFLBA) { | |||
EXPECT_THAT(json_content, testing::HasSubstr(json_contains)); | |||
} | |||
|
|||
// GH-44101: Test that JSON output is valid JSON | |||
TEST_F(TestJSONWithLocalFile, ValidJsonOutput) { | |||
auto checkJsonValid = [](std::string_view json_string) -> ::arrow::Status { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: check_valid_json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
https://github.com/apache/arrow/actions/runs/11514744258/job/32053979673?pr=44532 Emmm seems this is orc related, and unrelated to this patch? 🤔 |
@mapleFU The error message seems related, perhaps we need to make RapidJSON mandatory when Parquet tests are enabled?
|
Aha, my bad, will fix this |
@@ -320,7 +320,7 @@ if(ARROW_TESTING) | |||
# "link" our dependencies so that include paths are configured | |||
# correctly | |||
target_link_libraries(parquet_testing PUBLIC ${ARROW_GTEST_GMOCK}) | |||
list(APPEND PARQUET_TEST_LINK_LIBS parquet_testing) | |||
list(APPEND PARQUET_TEST_LINK_LIBS parquet_testing RapidJSON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add rapidjson to PARQUET_TEST_LINK_LIBS
, hope will not affect too much
Would merge this firstly |
Rationale for this change
The printJson is not a valid json now. This is ok for human-read, but when I want to analysis it with json tools or ai, it will prevent from using it.
What changes are included in this PR?
Change the output to be a valid json.
Style:
previously, the
\"
trailing would be added in start of object, but this patch put it to end of objectBefore:
After:
Are these changes tested?
Yes
Are there any user-facing changes?
Minor format change