kevingurney commented on code in PR #37981:
URL: https://github.com/apache/arrow/pull/37981#discussion_r1343299377


##########
cpp/src/arrow/pretty_print_test.cc:
##########
@@ -1020,6 +1067,37 @@ TEST_F(TestPrettyPrint, ChunkedArrayPrimitiveType) {
   CheckStream(chunked_array_2, {0}, expected_2);
 }
 
+TEST_F(TestPrettyPrint, ChunkedArrayPrimitiveTypeCustomArrayElementDelimiter) {
+  PrettyPrintOptions options{};
+  // Display array contents on one line.
+  options.skip_new_lines = true;
+  // Display maximum of 3 elements at the beginning and at the end of the array
+  options.window = 3;
+  // Use a custom array element delimiter of " | ",
+  // rather than the default delimiter (i.e. ",").
+  options.array_element_delimiter = " | ";
+
+  const auto chunk = ArrayFromJSON(int32(), "[1, 2, null, 4, null]");
+
+  // ChunkedArray with 1 chunk
+  {
+      const ChunkedArray chunked_array(chunk);
+
+      static const char* expected = R"expected([[1 | 2 | null | 4 | 
null]])expected";
+      CheckStream(chunked_array, options, expected);
+  }
+
+  // ChunkedArray with 2 chunks
+  {
+      const ChunkedArray chunked_array({chunk, chunk});
+
+      static const char* expected =
+          R"expected([[1 | 2 | null | 4 | null],[1 | 2 | null | 4 | 
null]])expected";

Review Comment:
   Yes, I believe that is right.
   
   See my comment: 
https://github.com/apache/arrow/pull/37981#discussion_r1343295807.
   
   To fully address https://github.com/apache/arrow/issues/30951, I think we 
could have two properties: (1) `array_element_delimiter` and (2) 
`chunked_array_element_delimiter`.
   
   Let me know if you like this approach and I can follow up with another PR to 
add `chunked_array_element_delimiter`.



##########
cpp/src/arrow/pretty_print_test.cc:
##########
@@ -1020,6 +1067,37 @@ TEST_F(TestPrettyPrint, ChunkedArrayPrimitiveType) {
   CheckStream(chunked_array_2, {0}, expected_2);
 }
 
+TEST_F(TestPrettyPrint, ChunkedArrayPrimitiveTypeCustomArrayElementDelimiter) {
+  PrettyPrintOptions options{};
+  // Display array contents on one line.
+  options.skip_new_lines = true;
+  // Display maximum of 3 elements at the beginning and at the end of the array
+  options.window = 3;
+  // Use a custom array element delimiter of " | ",
+  // rather than the default delimiter (i.e. ",").
+  options.array_element_delimiter = " | ";
+
+  const auto chunk = ArrayFromJSON(int32(), "[1, 2, null, 4, null]");
+
+  // ChunkedArray with 1 chunk
+  {
+      const ChunkedArray chunked_array(chunk);
+
+      static const char* expected = R"expected([[1 | 2 | null | 4 | 
null]])expected";
+      CheckStream(chunked_array, options, expected);
+  }
+
+  // ChunkedArray with 2 chunks
+  {
+      const ChunkedArray chunked_array({chunk, chunk});
+
+      static const char* expected =
+          R"expected([[1 | 2 | null | 4 | null],[1 | 2 | null | 4 | 
null]])expected";

Review Comment:
   Yes, that sounds right.
   
   See my comment: 
https://github.com/apache/arrow/pull/37981#discussion_r1343295807.
   
   To fully address https://github.com/apache/arrow/issues/30951, I think we 
could have two properties: (1) `array_element_delimiter` and (2) 
`chunked_array_element_delimiter`.
   
   Let me know if you like this approach and I can follow up with another PR to 
add `chunked_array_element_delimiter`.



-- 
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]

Reply via email to