You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/10/05 17:42:10 UTC

Re: [PR] GH-37710: [C++][Integration] Add C++ Utf8View implementation [arrow]

felipecrv commented on code in PR #37792:
URL: https://github.com/apache/arrow/pull/37792#discussion_r1347776507


##########
cpp/src/arrow/array/builder_binary.h:
##########
@@ -487,18 +487,42 @@ class ARROW_EXPORT StringHeapBuilder {
 
   void SetBlockSize(int64_t blocksize) { blocksize_ = blocksize; }
 
-  void UnsafeAppend(BinaryViewType::c_type* v) {
-    memcpy(current_out_buffer_, v->raw.data, v->size());
-    v->io = {v->size(), v->raw.prefix, static_cast<int32_t>(blocks_.size() - 1),
-             current_offset_};
-    current_out_buffer_ += v->size();
-    current_remaining_bytes_ -= v->size();
-    current_offset_ += static_cast<int32_t>(v->size());
+  using c_type = BinaryViewType::c_type;
+
+  template <bool Safe>
+  std::conditional_t<Safe, Result<c_type>, c_type> Append(const uint8_t* value,
+                                                          int64_t length) {

Review Comment:
   Might be a good idea to keep this private for now as this is not a pattern that extends to the other builders.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org