pitrou commented on code in PR #46536: URL: https://github.com/apache/arrow/pull/46536#discussion_r2122917826
########## python/pyarrow/array.pxi: ########## @@ -1357,7 +1357,8 @@ cdef class Array(_PandasConvertible): return f'{type_format}\n{self}' def to_string(self, *, int indent=2, int top_level_indent=0, int window=10, - int container_window=2, c_bool skip_new_lines=False): + int container_window=2, c_bool skip_new_lines=False, + int element_size_limit=100): Review Comment: Can you perhaps add a unit test for passing a specific element_size_limit? ########## python/pyarrow/array.pxi: ########## @@ -1383,6 +1384,9 @@ cdef class Array(_PandasConvertible): skip_new_lines : bool If the array should be rendered as a single line of text or if each element should be on its own line. + element_size_limit : int + Maximum length of a single element before it is truncated, + by default ``100``. Review Comment: "Length" is ambiguous, it might be misunderstood as the array length. We could be more precise and say "Maximum number of characters" for example. ########## cpp/src/arrow/pretty_print.cc: ########## @@ -104,11 +106,25 @@ 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 uint64_t max_chars) { Review Comment: I hadn't noticed this, but can this take a regular signed int, and the casting to `size_t` or `uint64_t` be done in the method body? ```suggestion void PrettyPrinter::Write(std::string_view data, const int max_chars) { ``` -- 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