From a8d71ba8c16623ad3eb3f9ffb224d9220c91f1a9 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Thu, 6 Jan 2022 08:32:47 -0800 Subject: [PATCH 01/13] Start pretty printing improvements --- cpp/src/arrow/pretty_print.cc | 1 + cpp/src/arrow/pretty_print.h | 7 ++++++- cpp/src/arrow/pretty_print_test.cc | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index 37135ed3ee84..d9792eae8b9e 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -69,6 +69,7 @@ class PrettyPrinter { PrettyPrintOptions ChildOptions() const { PrettyPrintOptions child_options = options_; child_options.indent = indent_; + child_options.window = options_.child_window; return child_options; } diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index 1bc086a68893..3c438c0b08e1 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -36,12 +36,13 @@ struct PrettyPrintOptions { PrettyPrintOptions() = default; PrettyPrintOptions(int indent_arg, // NOLINT runtime/explicit - int window_arg = 10, int indent_size_arg = 2, + int window_arg = 10, int child_window_arg = 5, int indent_size_arg = 2, std::string null_rep_arg = "null", bool skip_new_lines_arg = false, bool truncate_metadata_arg = true) : indent(indent_arg), indent_size(indent_size_arg), window(window_arg), + child_window(child_window_arg), null_rep(std::move(null_rep_arg)), skip_new_lines(skip_new_lines_arg), truncate_metadata(truncate_metadata_arg) {} @@ -57,6 +58,10 @@ struct PrettyPrintOptions { /// Maximum number of elements to show at the beginning and at the end. int window = 10; + /// For each element, maximum number of sub-elements to show at the beginning and the + /// end + int child_window = 5; + /// String to use for representing a null value, defaults to "null" std::string null_rep = "null"; diff --git a/cpp/src/arrow/pretty_print_test.cc b/cpp/src/arrow/pretty_print_test.cc index 7b47a05630ca..5356528ad08d 100644 --- a/cpp/src/arrow/pretty_print_test.cc +++ b/cpp/src/arrow/pretty_print_test.cc @@ -112,7 +112,7 @@ TEST_F(TestPrettyPrint, PrimitiveType) { 3, NA ])expected"; - CheckPrimitive({0, 10, 2, "NA"}, is_valid, values, expected_na, + CheckPrimitive({0, 10, 2, 2, "NA"}, is_valid, values, expected_na, false); static const char* ex_in2 = R"expected( [ @@ -740,6 +740,7 @@ TEST_F(TestPrettyPrint, ListTypeNoNewlines) { CheckArray(*array, options, "[[NA],[],NA,[4,5,6,7,8],[2,3]]", false); options.window = 2; + options.child_window = 2; CheckArray(*empty_array, options, "[]", false); CheckArray(*array, options, "[[NA],[],...,[4,5,...,7,8],[2,3]]", false); } @@ -809,7 +810,7 @@ TEST_F(TestPrettyPrint, FixedSizeListType) { 5 ] ])expected"); - CheckStream(*array, {0, 1}, R"expected([ + CheckStream(*array, {0, 1, 1}, R"expected([ [ null, ... From 0edef5525ab849429e4b8636c8b34d58f3c1f7db Mon Sep 17 00:00:00 2001 From: Will Jones Date: Thu, 6 Jan 2022 14:24:34 -0800 Subject: [PATCH 02/13] Expose options in Python --- python/pyarrow/includes/libarrow.pxd | 2 ++ python/pyarrow/table.pxi | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index 91f05868f2ff..47b8534a10a1 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -489,9 +489,11 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: PrettyPrintOptions() PrettyPrintOptions(int indent_arg) PrettyPrintOptions(int indent_arg, int window_arg) + PrettyPrintOptions(int indent_arg, int window_arg, int child_window_arg) int indent int indent_size int window + int child_window c_string null_rep c_bool skip_new_lines c_bool truncate_metadata diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 37ea5ace22d1..9ba6e36d7ad7 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -63,7 +63,7 @@ cdef class ChunkedArray(_PandasConvertible): type_format = object.__repr__(self) return '{0}\n{1}'.format(type_format, str(self)) - def to_string(self, *, int indent=0, int window=10, + def to_string(self, *, int indent=0, int window=2, int child_window=5, c_bool skip_new_lines=False): """ Render a "pretty-printed" string representation of the ChunkedArray @@ -74,9 +74,13 @@ cdef class ChunkedArray(_PandasConvertible): How much to indent right the content of the array, by default ``0``. window : int - How many items to preview at the begin and end + How many chunks to preview at the begin and end of the array when the arrays is bigger than the window. The other elements will be ellipsed. + child_window : int + How many items to preview within each chunk at the begin and end + of the chunk when the chunk is bigger than the window. + The other elements will be ellipsed. 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. @@ -86,7 +90,7 @@ cdef class ChunkedArray(_PandasConvertible): PrettyPrintOptions options with nogil: - options = PrettyPrintOptions(indent, window) + options = PrettyPrintOptions(indent, window, child_window) options.skip_new_lines = skip_new_lines check_status( PrettyPrint( From 19698a0a51935278ea72dfebb580d6831409e1d0 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Fri, 7 Jan 2022 08:52:10 -0800 Subject: [PATCH 03/13] Fix chunkedarray path --- cpp/src/arrow/pretty_print.cc | 1 + cpp/src/arrow/pretty_print.h | 6 +++--- python/pyarrow/includes/libarrow.pxd | 1 - python/pyarrow/table.pxi | 5 +++-- python/pyarrow/tests/test_table.py | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index d9792eae8b9e..e6e686a1f7ad 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -450,6 +450,7 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op skip_comma = true; } else { PrettyPrintOptions chunk_options = options; + chunk_options.window = options.child_window; chunk_options.indent += options.indent_size; ArrayPrinter printer(chunk_options, sink); RETURN_NOT_OK(printer.Print(*chunked_arr.chunk(i))); diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index 3c438c0b08e1..9271d626eacb 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -36,9 +36,9 @@ struct PrettyPrintOptions { PrettyPrintOptions() = default; PrettyPrintOptions(int indent_arg, // NOLINT runtime/explicit - int window_arg = 10, int child_window_arg = 5, int indent_size_arg = 2, - std::string null_rep_arg = "null", bool skip_new_lines_arg = false, - bool truncate_metadata_arg = true) + int window_arg = 10, int child_window_arg = 5, + int indent_size_arg = 2, std::string null_rep_arg = "null", + bool skip_new_lines_arg = false, bool truncate_metadata_arg = true) : indent(indent_arg), indent_size(indent_size_arg), window(window_arg), diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index 47b8534a10a1..34318bd34d1d 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -489,7 +489,6 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: PrettyPrintOptions() PrettyPrintOptions(int indent_arg) PrettyPrintOptions(int indent_arg, int window_arg) - PrettyPrintOptions(int indent_arg, int window_arg, int child_window_arg) int indent int indent_size int window diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 9ba6e36d7ad7..2201683bdb80 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -63,7 +63,7 @@ cdef class ChunkedArray(_PandasConvertible): type_format = object.__repr__(self) return '{0}\n{1}'.format(type_format, str(self)) - def to_string(self, *, int indent=0, int window=2, int child_window=5, + def to_string(self, *, int indent=0, int window=1, int child_window=3, c_bool skip_new_lines=False): """ Render a "pretty-printed" string representation of the ChunkedArray @@ -90,8 +90,9 @@ cdef class ChunkedArray(_PandasConvertible): PrettyPrintOptions options with nogil: - options = PrettyPrintOptions(indent, window, child_window) + options = PrettyPrintOptions(indent, window) options.skip_new_lines = skip_new_lines + options.child_window = child_window check_status( PrettyPrint( deref(self.chunked_array), diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 8caff25bf524..c088b2daa1af 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -1742,8 +1742,8 @@ def test_table_repr_to_string_ellipsis(): c0: int16 c1: int32 ---- -c0: [[1,2,3,4,1,2,3,4,1,2,...,3,4,1,2,3,4,1,2,3,4]] -c1: [[10,20,30,40,10,20,30,40,10,20,...,30,40,10,20,30,40,10,20,30,40]]""" +c0: [[1,2,3,...,2,3,4]] +c1: [[10,20,30,...,20,30,40]]""" def test_table_function_unicode_schema(): From 2a63f47e8cb4eeb55a7fca7d84c600fb7331ce88 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Mon, 10 Jan 2022 09:03:02 -0800 Subject: [PATCH 04/13] Try container_window --- cpp/src/arrow/pretty_print.cc | 15 ++++++++------- cpp/src/arrow/pretty_print.h | 10 +++++----- cpp/src/arrow/pretty_print_test.cc | 2 +- python/pyarrow/includes/libarrow.pxd | 2 +- python/pyarrow/table.pxi | 12 ++++++------ r/tests/testthat/test-chunked-array.txt | 20 -------------------- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index e6e686a1f7ad..991a1b05b562 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -69,7 +69,6 @@ class PrettyPrinter { PrettyPrintOptions ChildOptions() const { PrettyPrintOptions child_options = options_; child_options.indent = indent_; - child_options.window = options_.child_window; return child_options; } @@ -135,18 +134,20 @@ class ArrayPrinter : public PrettyPrinter { private: template Status WriteValues(const Array& array, FormatFunction&& func, - bool indent_non_null_values = true) { + bool indent_non_null_values = true, + bool is_container = false) { // `indent_non_null_values` should be false if `FormatFunction` applies // indentation itself. + int window = is_container ? options_.container_window : options_.window; for (int64_t i = 0; i < array.length(); ++i) { const bool is_last = (i == array.length() - 1); - if ((i >= options_.window) && (i < (array.length() - options_.window))) { + if ((i >= window) && (i < (array.length() - window))) { IndentAfterNewline(); (*sink_) << "..."; if (!is_last && options_.skip_new_lines) { (*sink_) << ","; } - i = array.length() - options_.window - 1; + i = array.length() - window - 1; } else if (array.IsNull(i)) { IndentAfterNewline(); (*sink_) << options_.null_rep; @@ -257,7 +258,8 @@ class ArrayPrinter : public PrettyPrinter { return values_printer.Print( *values->Slice(array.value_offset(i), array.value_length(i))); }, - /*indent_non_null_values=*/false); + /*indent_non_null_values=*/false, + /*is_container=*/true); } Status WriteDataValues(const MapArray& array) { @@ -419,7 +421,7 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op std::ostream* sink) { int num_chunks = chunked_arr.num_chunks(); int indent = options.indent; - int window = options.window; + int window = options.container_window; for (int i = 0; i < indent; ++i) { (*sink) << " "; @@ -450,7 +452,6 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op skip_comma = true; } else { PrettyPrintOptions chunk_options = options; - chunk_options.window = options.child_window; chunk_options.indent += options.indent_size; ArrayPrinter printer(chunk_options, sink); RETURN_NOT_OK(printer.Print(*chunked_arr.chunk(i))); diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index 9271d626eacb..b5eddaba4329 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -36,13 +36,13 @@ struct PrettyPrintOptions { PrettyPrintOptions() = default; PrettyPrintOptions(int indent_arg, // NOLINT runtime/explicit - int window_arg = 10, int child_window_arg = 5, + int window_arg = 10, int container_window_arg = 2, int indent_size_arg = 2, std::string null_rep_arg = "null", bool skip_new_lines_arg = false, bool truncate_metadata_arg = true) : indent(indent_arg), indent_size(indent_size_arg), window(window_arg), - child_window(child_window_arg), + container_window(container_window_arg), null_rep(std::move(null_rep_arg)), skip_new_lines(skip_new_lines_arg), truncate_metadata(truncate_metadata_arg) {} @@ -58,9 +58,9 @@ struct PrettyPrintOptions { /// Maximum number of elements to show at the beginning and at the end. int window = 10; - /// For each element, maximum number of sub-elements to show at the beginning and the - /// end - int child_window = 5; + /// Maximum number of elements to show at the beginning and at the end, for elements that + /// are containers. + int container_window = 5; /// String to use for representing a null value, defaults to "null" std::string null_rep = "null"; diff --git a/cpp/src/arrow/pretty_print_test.cc b/cpp/src/arrow/pretty_print_test.cc index 5356528ad08d..21231c76a11b 100644 --- a/cpp/src/arrow/pretty_print_test.cc +++ b/cpp/src/arrow/pretty_print_test.cc @@ -740,7 +740,7 @@ TEST_F(TestPrettyPrint, ListTypeNoNewlines) { CheckArray(*array, options, "[[NA],[],NA,[4,5,6,7,8],[2,3]]", false); options.window = 2; - options.child_window = 2; + options.container_window = 2; CheckArray(*empty_array, options, "[]", false); CheckArray(*array, options, "[[NA],[],...,[4,5,...,7,8],[2,3]]", false); } diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index 34318bd34d1d..a42623c4a2c2 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -492,7 +492,7 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: int indent int indent_size int window - int child_window + int container_window c_string null_rep c_bool skip_new_lines c_bool truncate_metadata diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 2201683bdb80..0f00609c35a4 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -63,7 +63,7 @@ cdef class ChunkedArray(_PandasConvertible): type_format = object.__repr__(self) return '{0}\n{1}'.format(type_format, str(self)) - def to_string(self, *, int indent=0, int window=1, int child_window=3, + def to_string(self, *, int indent=0, int window=5, int container_window=1, c_bool skip_new_lines=False): """ Render a "pretty-printed" string representation of the ChunkedArray @@ -74,13 +74,13 @@ cdef class ChunkedArray(_PandasConvertible): How much to indent right the content of the array, by default ``0``. window : int - How many chunks to preview at the begin and end - of the array when the arrays is bigger than the window. - The other elements will be ellipsed. - child_window : int How many items to preview within each chunk at the begin and end of the chunk when the chunk is bigger than the window. The other elements will be ellipsed. + container_window : int + How many chunks to preview at the begin and end + of the array when the arrays is bigger than the window. + The other elements will be ellipsed. Window also applies to list columns. 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. @@ -92,7 +92,7 @@ cdef class ChunkedArray(_PandasConvertible): with nogil: options = PrettyPrintOptions(indent, window) options.skip_new_lines = skip_new_lines - options.child_window = child_window + options.container_window = container_window check_status( PrettyPrint( deref(self.chunked_array), diff --git a/r/tests/testthat/test-chunked-array.txt b/r/tests/testthat/test-chunked-array.txt index c7101359d768..9af362a0e7d8 100644 --- a/r/tests/testthat/test-chunked-array.txt +++ b/r/tests/testthat/test-chunked-array.txt @@ -22,17 +22,7 @@ ChunkedArray 3, 4, 5, - 6, - 7, - 8, - 9, - 10, ... - 21, - 22, - 23, - 24, - 25, 26, 27, 28, @@ -55,17 +45,7 @@ ChunkedArray 3, 4, 5, - 6, - 7, - 8, - 9, - 10, ... - 21, - 22, - 23, - 24, - 25, 26, 27, 28, From e5679b07a309184178d587995372e08082c0fd58 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Mon, 10 Jan 2022 11:10:08 -0800 Subject: [PATCH 05/13] Update tests --- python/pyarrow/tests/test_table.py | 4 ++-- r/tests/testthat/test-chunked-array.txt | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index c088b2daa1af..11ecb101777f 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -1742,8 +1742,8 @@ def test_table_repr_to_string_ellipsis(): c0: int16 c1: int32 ---- -c0: [[1,2,3,...,2,3,4]] -c1: [[10,20,30,...,20,30,40]]""" +c0: [[1,2,3,4,1,...,4,1,2,3,4]] +c1: [[10,20,30,40,10,...,40,10,20,30,40]]""" def test_table_function_unicode_schema(): diff --git a/r/tests/testthat/test-chunked-array.txt b/r/tests/testthat/test-chunked-array.txt index 9af362a0e7d8..c7101359d768 100644 --- a/r/tests/testthat/test-chunked-array.txt +++ b/r/tests/testthat/test-chunked-array.txt @@ -22,7 +22,17 @@ ChunkedArray 3, 4, 5, + 6, + 7, + 8, + 9, + 10, ... + 21, + 22, + 23, + 24, + 25, 26, 27, 28, @@ -45,7 +55,17 @@ ChunkedArray 3, 4, 5, + 6, + 7, + 8, + 9, + 10, ... + 21, + 22, + 23, + 24, + 25, 26, 27, 28, From 36677492d0bbeac8882d25267b0626c2f7b11f84 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Mon, 10 Jan 2022 15:20:49 -0800 Subject: [PATCH 06/13] Fix struct type formatting --- cpp/src/arrow/pretty_print.cc | 32 +++++++++++++++---------- cpp/src/arrow/pretty_print.h | 2 +- python/pyarrow/array.pxi | 10 +++++--- python/pyarrow/table.pxi | 2 +- r/tests/testthat/test-chunked-array.txt | 32 ++++++++++++------------- 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index 991a1b05b562..f3df7db3d531 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -189,7 +189,7 @@ class ArrayPrinter : public PrettyPrinter { Status PrintChildren(const std::vector>& fields, int64_t offset, int64_t length) { for (size_t i = 0; i < fields.size(); ++i) { - Newline(); + Write("\n"); // Always want newline before child array description Indent(); std::stringstream ss; ss << "-- child " << i << " type: " << fields[i]->type()->ToString() << "\n"; @@ -199,7 +199,13 @@ class ArrayPrinter : public PrettyPrinter { if (offset != 0) { field = field->Slice(offset, length); } - RETURN_NOT_OK(PrettyPrint(*field, indent_ + options_.indent_size, sink_)); + Indent(); + // PrettyPrintOptions child_options = PrettyPrintOptions::Defaults(); + // child_options.indent_size = indent_ + options_.indent_size; + // child_options.skip_new_lines = options_.skip_new_lines; + // child_options.window = options_.window; + // child_options.container_window = options_.container_window; + RETURN_NOT_OK(PrettyPrint(*field, ChildOptions(), sink_)); } return Status::OK(); } @@ -271,7 +277,7 @@ class ArrayPrinter : public PrettyPrinter { return WriteValues( array, [&](int64_t i) { - Indent(); + IndentAfterNewline(); (*sink_) << "keys:"; Newline(); RETURN_NOT_OK(values_printer.Print( @@ -337,7 +343,7 @@ class ArrayPrinter : public PrettyPrinter { Indent(); Write("-- type_ids: "); UInt8Array type_codes(array.length(), array.type_codes(), nullptr, 0, array.offset()); - RETURN_NOT_OK(PrettyPrint(type_codes, indent_ + options_.indent_size, sink_)); + RETURN_NOT_OK(PrettyPrint(type_codes, ChildOptions(), sink_)); if (array.mode() == UnionMode::DENSE) { Newline(); @@ -346,7 +352,7 @@ class ArrayPrinter : public PrettyPrinter { Int32Array value_offsets( array.length(), checked_cast(array).value_offsets(), nullptr, 0, array.offset()); - RETURN_NOT_OK(PrettyPrint(value_offsets, indent_ + options_.indent_size, sink_)); + RETURN_NOT_OK(PrettyPrint(value_offsets, ChildOptions(), sink_)); } // Print the children without any offset, because the type ids are absolute @@ -363,12 +369,12 @@ class ArrayPrinter : public PrettyPrinter { Indent(); Write("-- dictionary:\n"); RETURN_NOT_OK( - PrettyPrint(*array.dictionary(), indent_ + options_.indent_size, sink_)); + PrettyPrint(*array.dictionary(), ChildOptions(), sink_)); Newline(); Indent(); Write("-- indices:\n"); - return PrettyPrint(*array.indices(), indent_ + options_.indent_size, sink_); + return PrettyPrint(*array.indices(), ChildOptions(), sink_); } Status Print(const Array& array) { @@ -387,7 +393,7 @@ Status ArrayPrinter::WriteValidityBitmap(const Array& array) { Indent(); BooleanArray is_valid(array.length(), array.null_bitmap(), nullptr, 0, array.offset()); - return PrettyPrint(is_valid, indent_ + options_.indent_size, sink_); + return PrettyPrint(is_valid, ChildOptions(), sink_); } else { Write(" all not null"); return Status::OK(); @@ -422,12 +428,14 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op int num_chunks = chunked_arr.num_chunks(); int indent = options.indent; int window = options.container_window; + // Struct fields are always on new line + bool skip_new_lines = options.skip_new_lines && (chunked_arr.type()->id() != Type::STRUCT); for (int i = 0; i < indent; ++i) { (*sink) << " "; } (*sink) << "["; - if (!options.skip_new_lines) { + if (!skip_new_lines) { *sink << "\n"; } bool skip_comma = true; @@ -436,7 +444,7 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op skip_comma = false; } else { (*sink) << ","; - if (!options.skip_new_lines) { + if (!skip_new_lines) { *sink << "\n"; } } @@ -444,8 +452,8 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op for (int i = 0; i < indent; ++i) { (*sink) << " "; } - (*sink) << "..."; - if (!options.skip_new_lines) { + (*sink) << "...,"; + if (!skip_new_lines) { *sink << "\n"; } i = num_chunks - window - 1; diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index b5eddaba4329..c7f19e63de38 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -60,7 +60,7 @@ struct PrettyPrintOptions { /// Maximum number of elements to show at the beginning and at the end, for elements that /// are containers. - int container_window = 5; + int container_window = 2; /// String to use for representing a null value, defaults to "null" std::string null_rep = "null"; diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 10ead0e6a951..9c302f5da263 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -1007,7 +1007,7 @@ cdef class Array(_PandasConvertible): return '{0}\n{1}'.format(type_format, str(self)) def to_string(self, *, int indent=2, int top_level_indent=0, int window=10, - c_bool skip_new_lines=False): + int container_window=2, c_bool skip_new_lines=False): """ Render a "pretty-printed" string representation of the Array. @@ -1020,9 +1020,13 @@ cdef class Array(_PandasConvertible): How much to indent right the entire content of the array, by default ``0``. window : int - How many items to preview at the begin and end - of the array when the arrays is bigger than the window. + How many primitive items to preview at the begin and end + of the array when the array is bigger than the window. The other elements will be ellipsed. + container_window : int + How many container elements (such as a list in a list array) + at the begin and end of the array when the array is bigger + than the window. 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. diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 0f00609c35a4..670c9681a2a6 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -63,7 +63,7 @@ cdef class ChunkedArray(_PandasConvertible): type_format = object.__repr__(self) return '{0}\n{1}'.format(type_format, str(self)) - def to_string(self, *, int indent=0, int window=5, int container_window=1, + def to_string(self, *, int indent=0, int window=5, int container_window=2, c_bool skip_new_lines=False): """ Render a "pretty-printed" string representation of the ChunkedArray diff --git a/r/tests/testthat/test-chunked-array.txt b/r/tests/testthat/test-chunked-array.txt index c7101359d768..f80f12ea8f87 100644 --- a/r/tests/testthat/test-chunked-array.txt +++ b/r/tests/testthat/test-chunked-array.txt @@ -79,25 +79,25 @@ ChunkedArray [ -- dictionary: - [ - "a", - "b" - ] + [ + "a", + "b" + ] -- indices: - [ - 0, - 1 - ], + [ + 0, + 1 + ], -- dictionary: - [ - "c", - "d" - ] + [ + "c", + "d" + ] -- indices: - [ - 0, - 1 - ] + [ + 0, + 1 + ] ] From 0a912fcfb960e9d0912953a62c4fe3d0ec6ecd62 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 11 Jan 2022 12:58:41 -0800 Subject: [PATCH 07/13] Cleanup old comments --- cpp/src/arrow/pretty_print.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index f3df7db3d531..657eba9f2cf7 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -200,11 +200,6 @@ class ArrayPrinter : public PrettyPrinter { field = field->Slice(offset, length); } Indent(); - // PrettyPrintOptions child_options = PrettyPrintOptions::Defaults(); - // child_options.indent_size = indent_ + options_.indent_size; - // child_options.skip_new_lines = options_.skip_new_lines; - // child_options.window = options_.window; - // child_options.container_window = options_.container_window; RETURN_NOT_OK(PrettyPrint(*field, ChildOptions(), sink_)); } return Status::OK(); From e7e523aa7a88137d6b3b4b872e77c0411fd35898 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 11 Jan 2022 14:02:38 -0800 Subject: [PATCH 08/13] Update tests --- cpp/src/arrow/pretty_print.cc | 31 +++++++------- cpp/src/arrow/pretty_print.h | 4 +- cpp/src/arrow/pretty_print_test.cc | 66 ++++++++++++++++++++++++++---- 3 files changed, 78 insertions(+), 23 deletions(-) diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index 657eba9f2cf7..01d7f2129087 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -66,9 +66,13 @@ class PrettyPrinter { void CloseArray(const Array& array); void Flush() { (*sink_) << std::flush; } - PrettyPrintOptions ChildOptions() const { + PrettyPrintOptions ChildOptions(bool increment_indent = false) const { PrettyPrintOptions child_options = options_; - child_options.indent = indent_; + if (increment_indent) { + child_options.indent = indent_ + child_options.indent_size; + } else { + child_options.indent = indent_; + } return child_options; } @@ -134,8 +138,7 @@ class ArrayPrinter : public PrettyPrinter { private: template Status WriteValues(const Array& array, FormatFunction&& func, - bool indent_non_null_values = true, - bool is_container = false) { + bool indent_non_null_values = true, bool is_container = false) { // `indent_non_null_values` should be false if `FormatFunction` applies // indentation itself. int window = is_container ? options_.container_window : options_.window; @@ -189,7 +192,7 @@ class ArrayPrinter : public PrettyPrinter { Status PrintChildren(const std::vector>& fields, int64_t offset, int64_t length) { for (size_t i = 0; i < fields.size(); ++i) { - Write("\n"); // Always want newline before child array description + Write("\n"); // Always want newline before child array description Indent(); std::stringstream ss; ss << "-- child " << i << " type: " << fields[i]->type()->ToString() << "\n"; @@ -199,8 +202,8 @@ class ArrayPrinter : public PrettyPrinter { if (offset != 0) { field = field->Slice(offset, length); } - Indent(); - RETURN_NOT_OK(PrettyPrint(*field, ChildOptions(), sink_)); + // Indent(); + RETURN_NOT_OK(PrettyPrint(*field, ChildOptions(true), sink_)); } return Status::OK(); } @@ -338,7 +341,7 @@ class ArrayPrinter : public PrettyPrinter { Indent(); Write("-- type_ids: "); UInt8Array type_codes(array.length(), array.type_codes(), nullptr, 0, array.offset()); - RETURN_NOT_OK(PrettyPrint(type_codes, ChildOptions(), sink_)); + RETURN_NOT_OK(PrettyPrint(type_codes, ChildOptions(true), sink_)); if (array.mode() == UnionMode::DENSE) { Newline(); @@ -347,7 +350,7 @@ class ArrayPrinter : public PrettyPrinter { Int32Array value_offsets( array.length(), checked_cast(array).value_offsets(), nullptr, 0, array.offset()); - RETURN_NOT_OK(PrettyPrint(value_offsets, ChildOptions(), sink_)); + RETURN_NOT_OK(PrettyPrint(value_offsets, ChildOptions(true), sink_)); } // Print the children without any offset, because the type ids are absolute @@ -363,13 +366,12 @@ class ArrayPrinter : public PrettyPrinter { Newline(); Indent(); Write("-- dictionary:\n"); - RETURN_NOT_OK( - PrettyPrint(*array.dictionary(), ChildOptions(), sink_)); + RETURN_NOT_OK(PrettyPrint(*array.dictionary(), ChildOptions(true), sink_)); Newline(); Indent(); Write("-- indices:\n"); - return PrettyPrint(*array.indices(), ChildOptions(), sink_); + return PrettyPrint(*array.indices(), ChildOptions(true), sink_); } Status Print(const Array& array) { @@ -388,7 +390,7 @@ Status ArrayPrinter::WriteValidityBitmap(const Array& array) { Indent(); BooleanArray is_valid(array.length(), array.null_bitmap(), nullptr, 0, array.offset()); - return PrettyPrint(is_valid, ChildOptions(), sink_); + return PrettyPrint(is_valid, ChildOptions(true), sink_); } else { Write(" all not null"); return Status::OK(); @@ -424,7 +426,8 @@ Status PrettyPrint(const ChunkedArray& chunked_arr, const PrettyPrintOptions& op int indent = options.indent; int window = options.container_window; // Struct fields are always on new line - bool skip_new_lines = options.skip_new_lines && (chunked_arr.type()->id() != Type::STRUCT); + bool skip_new_lines = + options.skip_new_lines && (chunked_arr.type()->id() != Type::STRUCT); for (int i = 0; i < indent; ++i) { (*sink) << " "; diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index c7f19e63de38..404c544340bc 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -58,8 +58,8 @@ struct PrettyPrintOptions { /// Maximum number of elements to show at the beginning and at the end. int window = 10; - /// Maximum number of elements to show at the beginning and at the end, for elements that - /// are containers. + /// Maximum number of elements to show at the beginning and at the end, for elements + /// that are containers (that is, list in ListArray and chunks in ChunkedArray) int container_window = 2; /// String to use for representing a null value, defaults to "null" diff --git a/cpp/src/arrow/pretty_print_test.cc b/cpp/src/arrow/pretty_print_test.cc index 21231c76a11b..a99f29ed08b3 100644 --- a/cpp/src/arrow/pretty_print_test.cc +++ b/cpp/src/arrow/pretty_print_test.cc @@ -715,17 +715,35 @@ TEST_F(TestPrettyPrint, ListType) { 3 ] ])expected"; + static const char* ex_4 = R"expected([ + [ + null + ], + [], + ... + [ + 4, + 6, + 7 + ], + [ + 2, + 3 + ] +])expected"; auto array = ArrayFromJSON(list_type, "[[null], [], null, [4, 6, 7], [2, 3]]"); - CheckArray(*array, {0, 10}, ex); - CheckArray(*array, {2, 10}, ex_2); - CheckStream(*array, {0, 1}, ex_3); + CheckArray(*array, {0, 10, 5}, ex, false); + CheckArray(*array, {2, 10, 5}, ex_2, false); + CheckArray(*array, {0, 10, 1}, ex_3, false); + CheckArray(*array, {0, 10}, ex_4); list_type = large_list(int64()); array = ArrayFromJSON(list_type, "[[null], [], null, [4, 6, 7], [2, 3]]"); - CheckArray(*array, {0, 10}, ex); - CheckArray(*array, {2, 10}, ex_2); - CheckStream(*array, {0, 1}, ex_3); + CheckArray(*array, {0, 10, 5}, ex, false); + CheckArray(*array, {2, 10, 5}, ex_2, false); + CheckArray(*array, {0, 10, 1}, ex_3, false); + CheckArray(*array, {0, 10}, ex_4); } TEST_F(TestPrettyPrint, ListTypeNoNewlines) { @@ -736,6 +754,7 @@ TEST_F(TestPrettyPrint, ListTypeNoNewlines) { PrettyPrintOptions options{}; options.skip_new_lines = true; options.null_rep = "NA"; + options.container_window = 10; CheckArray(*empty_array, options, "[]", false); CheckArray(*array, options, "[[NA],[],NA,[4,5,6,7,8],[2,3]]", false); @@ -780,6 +799,14 @@ TEST_F(TestPrettyPrint, MapType) { [] ])expected"; CheckArray(*array, {0, 10}, ex); + + PrettyPrintOptions options{}; + options.skip_new_lines = true; + + static const char* ex_flat = + R"expected([keys:["joe","mark"]values:[0,null],null,)expected" + R"expected(keys:["cap"]values:[8],keys:[]values:[]])expected"; + CheckArray(*array, options, ex_flat, false); } TEST_F(TestPrettyPrint, FixedSizeListType) { @@ -798,7 +825,7 @@ TEST_F(TestPrettyPrint, FixedSizeListType) { 3, null ], - null, + ... [ 4, 6, @@ -810,6 +837,31 @@ TEST_F(TestPrettyPrint, FixedSizeListType) { 5 ] ])expected"); + + CheckStream(*array, {0, 1, 3}, R"expected([ + [ + null, + ... + 1 + ], + [ + 2, + ... + null + ], + null, + [ + 4, + ... + 7 + ], + [ + 8, + ... + 5 + ] +])expected"); + CheckStream(*array, {0, 1, 1}, R"expected([ [ null, From 360b0332b4bb6bcfdcd810a7f7101555af479141 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 11 Jan 2022 14:52:40 -0800 Subject: [PATCH 09/13] Fix R test --- r/tests/testthat/test-chunked-array.txt | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/r/tests/testthat/test-chunked-array.txt b/r/tests/testthat/test-chunked-array.txt index f80f12ea8f87..c7101359d768 100644 --- a/r/tests/testthat/test-chunked-array.txt +++ b/r/tests/testthat/test-chunked-array.txt @@ -79,25 +79,25 @@ ChunkedArray [ -- dictionary: - [ - "a", - "b" - ] + [ + "a", + "b" + ] -- indices: - [ - 0, - 1 - ], + [ + 0, + 1 + ], -- dictionary: - [ - "c", - "d" - ] + [ + "c", + "d" + ] -- indices: - [ - 0, - 1 - ] + [ + 0, + 1 + ] ] From 046918fb11802190e8686e43bfb96b53f33a7bc4 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 18 Jan 2022 10:40:39 -0800 Subject: [PATCH 10/13] Fix arg ordering, add test for struct type Co-authored-by: Antoine Pitrou --- cpp/src/arrow/pretty_print.h | 22 ++++++------ cpp/src/arrow/pretty_print_test.cc | 54 +++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/cpp/src/arrow/pretty_print.h b/cpp/src/arrow/pretty_print.h index 404c544340bc..5d22fd5c51ab 100644 --- a/cpp/src/arrow/pretty_print.h +++ b/cpp/src/arrow/pretty_print.h @@ -35,17 +35,17 @@ class Table; struct PrettyPrintOptions { PrettyPrintOptions() = default; - PrettyPrintOptions(int indent_arg, // NOLINT runtime/explicit - int window_arg = 10, int container_window_arg = 2, - int indent_size_arg = 2, std::string null_rep_arg = "null", - bool skip_new_lines_arg = false, bool truncate_metadata_arg = true) - : indent(indent_arg), - indent_size(indent_size_arg), - window(window_arg), - container_window(container_window_arg), - null_rep(std::move(null_rep_arg)), - skip_new_lines(skip_new_lines_arg), - truncate_metadata(truncate_metadata_arg) {} + PrettyPrintOptions(int indent, // NOLINT runtime/explicit + int window = 10, int indent_size = 2, std::string null_rep = "null", + bool skip_new_lines = false, bool truncate_metadata = true, + int container_window = 2) + : indent(indent), + indent_size(indent_size), + window(window), + container_window(container_window), + null_rep(std::move(null_rep)), + skip_new_lines(skip_new_lines), + truncate_metadata(truncate_metadata) {} static PrettyPrintOptions Defaults() { return PrettyPrintOptions(); } diff --git a/cpp/src/arrow/pretty_print_test.cc b/cpp/src/arrow/pretty_print_test.cc index a99f29ed08b3..eaace0dbcec1 100644 --- a/cpp/src/arrow/pretty_print_test.cc +++ b/cpp/src/arrow/pretty_print_test.cc @@ -112,7 +112,7 @@ TEST_F(TestPrettyPrint, PrimitiveType) { 3, NA ])expected"; - CheckPrimitive({0, 10, 2, 2, "NA"}, is_valid, values, expected_na, + CheckPrimitive({0, 10, 2, "NA"}, is_valid, values, expected_na, false); static const char* ex_in2 = R"expected( [ @@ -642,6 +642,24 @@ TEST_F(TestPrettyPrint, StructTypeAdvanced) { CheckStream(*array, {0, 10}, ex); } +TEST_F(TestPrettyPrint, StructTypeNoNewLines) { + // Struct types will at least have new lines for arrays + auto simple_1 = field("one", int32()); + auto simple_2 = field("two", int32()); + auto simple_struct = struct_({simple_1, simple_2}); + + auto array = ArrayFromJSON(simple_struct, "[[11, 22], null, [null, 33]]"); + auto options = PrettyPrintOptions(); + options.skip_new_lines = true; + + static const char* ex = R"expected(-- is_valid:[true,false,true] +-- child 0 type: int32 +[11,0,null] +-- child 1 type: int32 +[22,0,33])expected"; + CheckStream(*array, options, ex); +} + TEST_F(TestPrettyPrint, BinaryType) { std::vector is_valid = {true, true, false, true, true, true}; std::vector values = {"foo", "bar", "", "baz", "", "\xff"}; @@ -733,16 +751,27 @@ TEST_F(TestPrettyPrint, ListType) { ])expected"; auto array = ArrayFromJSON(list_type, "[[null], [], null, [4, 6, 7], [2, 3]]"); - CheckArray(*array, {0, 10, 5}, ex, false); - CheckArray(*array, {2, 10, 5}, ex_2, false); - CheckArray(*array, {0, 10, 1}, ex_3, false); + auto make_options = [](int indent, int window, int container_window) { + auto options = PrettyPrintOptions(indent, window); + options.container_window = container_window; + return options; + }; + CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/5), + ex); + CheckStream(*array, make_options(/*indent=*/2, /*window=*/10, /*container_window=*/5), + ex_2); + CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/1), + ex_3); CheckArray(*array, {0, 10}, ex_4); list_type = large_list(int64()); array = ArrayFromJSON(list_type, "[[null], [], null, [4, 6, 7], [2, 3]]"); - CheckArray(*array, {0, 10, 5}, ex, false); - CheckArray(*array, {2, 10, 5}, ex_2, false); - CheckArray(*array, {0, 10, 1}, ex_3, false); + CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/5), + ex); + CheckStream(*array, make_options(/*indent=*/2, /*window=*/10, /*container_window=*/5), + ex_2); + CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/1), + ex_3); CheckArray(*array, {0, 10}, ex_4); } @@ -838,7 +867,13 @@ TEST_F(TestPrettyPrint, FixedSizeListType) { ] ])expected"); - CheckStream(*array, {0, 1, 3}, R"expected([ + auto make_options = [](int indent, int window, int container_window) { + auto options = PrettyPrintOptions(indent, window); + options.container_window = container_window; + return options; + }; + CheckStream(*array, make_options(/*indent=*/0, /*window=*/1, /*container_window=*/3), + R"expected([ [ null, ... @@ -862,7 +897,8 @@ TEST_F(TestPrettyPrint, FixedSizeListType) { ] ])expected"); - CheckStream(*array, {0, 1, 1}, R"expected([ + CheckStream(*array, make_options(/*indent=*/0, /*window=*/1, /*container_window=*/1), + R"expected([ [ null, ... From e5634193d37225b2bf06f708482667bc9353c185 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 18 Jan 2022 10:53:33 -0800 Subject: [PATCH 11/13] Add consistency to doc comments Co-authored-by: Antoine Pitrou --- python/pyarrow/array.pxi | 8 ++++---- python/pyarrow/table.pxi | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 9c302f5da263..2a40e658b4e6 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -1022,11 +1022,11 @@ cdef class Array(_PandasConvertible): window : int How many primitive items to preview at the begin and end of the array when the array is bigger than the window. - The other elements will be ellipsed. + The other items will be ellipsed. container_window : int - How many container elements (such as a list in a list array) - at the begin and end of the array when the array is bigger - than the window. + How many container items (such as a list in a list array) + to preview at the begin and end of the array when the array + is bigger than the window. 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. diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 670c9681a2a6..3aa7867e0315 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -80,7 +80,8 @@ cdef class ChunkedArray(_PandasConvertible): container_window : int How many chunks to preview at the begin and end of the array when the arrays is bigger than the window. - The other elements will be ellipsed. Window also applies to list columns. + The other elements will be ellipsed. + This setting also applies to list columns. 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. From 496a04b7bdf1d2e76db8baebdbc419d8cabde6eb Mon Sep 17 00:00:00 2001 From: Will Jones Date: Tue, 18 Jan 2022 13:32:08 -0800 Subject: [PATCH 12/13] Fix linting issues --- cpp/src/arrow/pretty_print_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/src/arrow/pretty_print_test.cc b/cpp/src/arrow/pretty_print_test.cc index eaace0dbcec1..bebbc6e82e39 100644 --- a/cpp/src/arrow/pretty_print_test.cc +++ b/cpp/src/arrow/pretty_print_test.cc @@ -757,21 +757,21 @@ TEST_F(TestPrettyPrint, ListType) { return options; }; CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/5), - ex); + ex); CheckStream(*array, make_options(/*indent=*/2, /*window=*/10, /*container_window=*/5), - ex_2); + ex_2); CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/1), - ex_3); + ex_3); CheckArray(*array, {0, 10}, ex_4); list_type = large_list(int64()); array = ArrayFromJSON(list_type, "[[null], [], null, [4, 6, 7], [2, 3]]"); CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/5), - ex); + ex); CheckStream(*array, make_options(/*indent=*/2, /*window=*/10, /*container_window=*/5), - ex_2); + ex_2); CheckStream(*array, make_options(/*indent=*/0, /*window=*/10, /*container_window=*/1), - ex_3); + ex_3); CheckArray(*array, {0, 10}, ex_4); } From 349bf1a2de804958e2fc4e4818df7792d21536e5 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 27 Jan 2022 11:39:24 +0100 Subject: [PATCH 13/13] Fix existing typo --- python/pyarrow/table.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 3aa7867e0315..de2bba790af6 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -79,7 +79,7 @@ cdef class ChunkedArray(_PandasConvertible): The other elements will be ellipsed. container_window : int How many chunks to preview at the begin and end - of the array when the arrays is bigger than the window. + of the array when the array is bigger than the window. The other elements will be ellipsed. This setting also applies to list columns. skip_new_lines : bool