andishgar commented on code in PR #46031: URL: https://github.com/apache/arrow/pull/46031#discussion_r2053398198
########## cpp/src/arrow/record_batch_test.cc: ########## @@ -1033,15 +1040,32 @@ Result<std::shared_ptr<Array>> BuildArray( } return builder.Finish(); } +struct StringBuilderVisitor { + template <typename DataType> + enable_if_t<has_string_view<DataType>::value, Status> Visit( + const DataType&, ArrayBuilder* raw_builder, + const std::vector<std::string>& values) { + using Builder = typename TypeTraits<DataType>::BuilderType; + Builder* builder = static_cast<Builder*>(raw_builder); + for (const auto& value : values) { + ARROW_RETURN_NOT_OK(builder->Append(value)); + } Review Comment: > Can we simplify this code by using `Append()` for `Binary`/`String`? This is a test. So we can use unoptimized methods. My initial implementation used the `AppendValues` method. However, since `binary_view()` and `utf8_view()` do not support AppendValues, I had to use two separate paths for adding strings. You suggested using a single, unoptimized path instead. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org