Reranko05 commented on code in PR #51014:
URL: https://github.com/apache/arrow/pull/51014#discussion_r3954162835


##########
cpp/src/arrow/json/test_common.h:
##########
@@ -258,14 +261,26 @@ inline static Status ParseFromString(ParseOptions 
options, string_view src_str,
 }
 
 static inline std::string PrettyPrint(string_view one_line) {
-  rj::Document document;
+  simdjson::ondemand::parser parser;
 
   // Must pass size to avoid ASAN issues.
-  document.Parse(one_line.data(), one_line.size());
-  rj::StringBuffer sb;
-  rj::PrettyWriter<rj::StringBuffer> writer(sb);
-  document.Accept(writer);
-  return sb.GetString();
+  simdjson::padded_string json(one_line.data(), one_line.size());

Review Comment:
   I switched `PrettyPrint()` to use `simdjson::fractured_json_string()` 
directly and removed the custom `PrettyPrintJsonValue()` formatter.
   
   I verified the relevant JSON tests:
   - `ChunkerTest.PrettyPrinted` — passed
   - `ChunkerTest.StraddlingPrettyPrinted` — passed
   - `JsonTest.PrettyPrintEscapesObjectKeys` — updated the expected output from 
the previous 4-space multiline RapidJSON formatting:
   ```cpp
   {
   "a"b": 1,
   "a\b": 2
   }
   ```
   to FracturedJson's compact formatting:
   
   ```cpp
   { "a"b": 1, "a\b": 2 }
   ```
   and the test passed.
   
   The escaped-key behavior is still covered by the test, while the custom 
recursive pretty-printing implementation and its dedicated test have been 
removed.



-- 
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]

Reply via email to