taepper commented on code in PR #50945:
URL: https://github.com/apache/arrow/pull/50945#discussion_r4003652267


##########
cpp/src/arrow/json/chunker.cc:
##########
@@ -165,14 +92,94 @@ class ParsingBoundaryFinder : public BoundaryFinder {
                  int64_t* out_pos, int64_t* num_found) override {
     return Status::NotImplemented("ParsingBoundaryFinder::FindNth");
   }
+
+ private:
+  MemoryPool* pool_;
+  simdjson::ondemand::parser parser_;
+  // A persistent buffer to keep padded contents for simdjson.
+  // This should be more efficient than allocating a new padded_string 
everytime.
+  std::shared_ptr<ResizableBuffer> buffer_;
+
+  Result<simdjson::padded_string_view> GetPaddedStringView(std::string_view 
partial,
+                                                           std::string_view 
block = {}) {
+    const auto data_size = partial.size() + block.size();
+    const auto required_size = data_size + simdjson::SIMDJSON_PADDING;
+    if (!buffer_) {
+      ARROW_ASSIGN_OR_RAISE(buffer_, AllocateResizableBuffer(
+                                         /*size=*/0, pool_));

Review Comment:
   Nit: we could immediately pass `required_size` here



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