mapleFU commented on code in PR #46730:
URL: https://github.com/apache/arrow/pull/46730#discussion_r2133344885
##########
cpp/src/arrow/array/builder_binary.h:
##########
@@ -511,6 +511,18 @@ class ARROW_EXPORT StringHeapBuilder {
return v;
}
+ c_type GetViewFromBlock(int32_t block_id, int32_t block_offset, int32_t
offset,
+ int32_t length) const {
+ const auto* value = blocks_.at(block_id)->data_as<uint8_t>() +
block_offset + offset;
+ if (length <= BinaryViewType::kInlineSize) {
Review Comment:
Uses `ToBinaryView`?
##########
cpp/src/arrow/array/builder_binary.h:
##########
@@ -645,6 +657,28 @@ class ARROW_EXPORT BinaryViewBuilder : public ArrayBuilder
{
UnsafeAppend(value.data(), static_cast<int64_t>(value.size()));
}
+ Result<std::pair<int32_t, int32_t>> AppendBlock(const uint8_t* value,
+ const int64_t length);
+
+ Result<std::pair<int32_t, int32_t>> AppendBlock(const char* value,
+ const int64_t length) {
+ return AppendBlock(reinterpret_cast<const uint8_t*>(value), length);
+ }
+
+ Result<std::pair<int32_t, int32_t>> AppendBlock(const std::string& value) {
+ return AppendBlock(value.data(), static_cast<int64_t>(value.size()));
+ }
+
+ Status AppendViewFromBuffer(int32_t buffer_id, int32_t buffer_offset,
int32_t start,
Review Comment:
naming: from buffer or from block?
##########
cpp/src/arrow/array/builder_binary.cc:
##########
@@ -100,6 +100,13 @@ void BinaryViewBuilder::Reset() {
data_heap_builder_.Reset();
}
+Result<std::pair<int32_t, int32_t>> BinaryViewBuilder::AppendBlock(const
uint8_t* value,
+ const
int64_t length) {
+ DCHECK_GT(length, TypeClass::kInlineSize);
Review Comment:
If length <= kInlineSize, should this return false or ok? Why just DCHECK
here?
##########
cpp/src/arrow/array/builder_binary.h:
##########
@@ -645,6 +657,28 @@ class ARROW_EXPORT BinaryViewBuilder : public ArrayBuilder
{
UnsafeAppend(value.data(), static_cast<int64_t>(value.size()));
}
+ Result<std::pair<int32_t, int32_t>> AppendBlock(const uint8_t* value,
Review Comment:
Can we use more specific name rather than `pair<i32, i32>`?
--
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]