pitrou commented on code in PR #46536: URL: https://github.com/apache/arrow/pull/46536#discussion_r2109493139
########## cpp/src/arrow/pretty_print.cc: ########## @@ -104,11 +106,30 @@ void PrettyPrinter::CloseArray(const Array& array) { (*sink_) << options_.array_delimiters.close; } -void PrettyPrinter::Write(std::string_view data) { (*sink_) << data; } +void PrettyPrinter::Write(std::string_view data) { + Write(data, options_.element_size_limit); +} + +void PrettyPrinter::Write(std::string_view data, const int max_chars) { + int curr_max = max_chars; + for (auto c : data) { + if (curr_max-- > 0) { + sink_->put(c); Review Comment: You should certainly use `string_view::substr` instead of putting chars one by one. -- 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