Bankim Bhavsar has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/17808 )

Change subject: [tool] Support to dump and edit pbc in JSON pretty format
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/17808/1/src/kudu/tools/tool_action_pbc.cc
File src/kudu/tools/tool_action_pbc.cc:

http://gerrit.cloudera.org:8080/#/c/17808/1/src/kudu/tools/tool_action_pbc.cc@216
PS1, Line 216:     char read_buffer[65536];
             :     rapidjson::FileReadStream in_stream(fp, read_buffer, 
sizeof(read_buffer));
             :
             :     JsonParseOptions opts;
             :     opts.case_insensitive_enum_parsing = true;
             :     do {
             :       rapidjson::Document document;
             :       
document.ParseStream<rapidjson::kParseStopWhenDoneFlag>(in_stream);
             :       if (document.HasParseError()) {
             :         auto code = document.GetParseError();
             :         if (code != rapidjson::kParseErrorDocumentEmpty) {
             :           return Status::Corruption("JSON text is corrupt",
             :                                     
rapidjson::GetParseError_En(code));
             :         }
             :         break;
             :       }
             :
             :       rapidjson::StringBuffer buffer;
             :       rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
             :       document.Accept(writer);
             :
             :       m->Clear();
             :       auto str = buffer.GetString();
             :       const auto& google_status = JsonStringToMessage(str, 
m.get(), opts);
             :       if (!google_status.ok()) {
             :         return Status::InvalidArgument(
             :             Substitute("Unable to parse JSON text: $0", str),
             :             google_status.error_message().ToString());
             :       }
             :       RETURN_NOT_OK_PREPEND(pb_writer.Append(*m), "unable to 
append PB to output");
             :     } while (true);
             :     RETURN_NOT_OK_PREPEND(pb_writer.Sync(), "failed to sync 
output");
             :     RETURN_NOT_OK_PREPEND(pb_writer.Close(), "failed to close 
output");
             :   }
Can you explain the motivation behind this change to read the document at once 
v/s parsing one line at a time?



--
To view, visit http://gerrit.cloudera.org:8080/17808
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I6d404e6cd487a644fa848513670c4945bf789578
Gerrit-Change-Number: 17808
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <[email protected]>
Gerrit-Reviewer: Bankim Bhavsar <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Tue, 24 Aug 2021 17:13:30 +0000
Gerrit-HasComments: Yes

Reply via email to