bkietz commented on code in PR #35628:
URL: https://github.com/apache/arrow/pull/35628#discussion_r1231432597
##########
cpp/src/arrow/array/array_binary_test.cc:
##########
@@ -365,38 +368,206 @@ TYPED_TEST(TestStringArray, TestValidateOffsets) {
this->TestValidateOffsets();
TYPED_TEST(TestStringArray, TestValidateData) { this->TestValidateData(); }
+namespace string_header_helpers {
+
+StringHeader Inline(std::string_view chars) {
+ assert(StringHeader::IsInline(chars.size()));
+ return StringHeader{chars};
+}
+
+StringHeader NotInline(std::string_view prefix, size_t length, size_t
buffer_index,
+ size_t offset) {
+ assert(prefix.size() == 4);
+ assert(!StringHeader::IsInline(length));
+ StringHeader s{prefix.data(), length};
+ s.SetIndexOffset(static_cast<uint32_t>(buffer_index),
static_cast<uint32_t>(offset));
+ return s;
+}
+
+Result<std::shared_ptr<StringViewArray>> MakeArray(
+ BufferVector char_buffers, const std::vector<StringHeader>& headers,
+ bool validate = true) {
+ auto length = static_cast<int64_t>(headers.size());
+ ARROW_ASSIGN_OR_RAISE(auto headers_buf, CopyBufferFromVector(headers));
+ auto arr = std::make_shared<StringViewArray>(length, std::move(headers_buf),
+ std::move(char_buffers));
+ if (validate) {
+ RETURN_NOT_OK(arr->ValidateFull());
+ }
+ return arr;
+}
+
+Result<std::shared_ptr<StringViewArray>> MakeArrayFromRawPointerViews(
Review Comment:
I'll add a comment
--
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]