New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MATLAB] Improve array display #38398
Comments
take |
kevingurney
pushed a commit
that referenced
this issue
Oct 24, 2023
### Rationale for this change Currently, the display for `arrow.array.Array`s is not very MATLAB-like: ```matlab >> a = arrow.array([1 2 3 4]) a = [ 1, 2, 3, ] ``` At the very least, the display should include the class header and indent each line by 4 spaces. Here's one display option: ```matlab >> a = arrow.array([1 2 3 4]) a = Float64Array with 4 elements and 0 null values: 1 | 2 | 3 | 4 ``` ### What changes are included in this PR? 1. Array display now includes a class header, which states the array type and the number of elements/nulls in the array. 2. Changed the [`window`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L79C1-L80C1) size to 3 from 10. 3. Primitive and string arrays are displayed horizontally, i.e. set [`skip_new_lines`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L90) to `false`. Uses ` | ` as the delimiter between elements with no opening/closing brackets. 4. All other array types (`struct`, `list`, etc) are displayed vertically with an `indent` of 4. **Example String Array Display:** ```matlab >> a = arrow.array(["Hello", missing, "Bye"]) a = StringArray with 3 elements and 1 null value: "Hello" | null | "Bye" ``` **Example Struct Array Display:** ```matlab >> a1 = arrow.array(["Hello", missing, "Bye"]); >> a2 = arrow.array([1 2 3]); >> structArray = arrow.array.StructArray.fromArrays(a1, a2) structArray = StructArray with 3 elements and 0 null values: -- is_valid: all not null -- child 0 type: string [ "Hello", null, "Bye" ] -- child 1 type: double [ 1, 2, 3 ] ``` ### Are these changes tested? Yes. Added a new test class called `tArrayDisplay.m` with unit tests for array display. ### Are there any user-facing changes? Yes. Users will see a different display for arrays now. ### Future Directions 1. #38166 * Closes: #38398 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
JerAguilon
pushed a commit
to JerAguilon/arrow
that referenced
this issue
Oct 25, 2023
### Rationale for this change Currently, the display for `arrow.array.Array`s is not very MATLAB-like: ```matlab >> a = arrow.array([1 2 3 4]) a = [ 1, 2, 3, ] ``` At the very least, the display should include the class header and indent each line by 4 spaces. Here's one display option: ```matlab >> a = arrow.array([1 2 3 4]) a = Float64Array with 4 elements and 0 null values: 1 | 2 | 3 | 4 ``` ### What changes are included in this PR? 1. Array display now includes a class header, which states the array type and the number of elements/nulls in the array. 2. Changed the [`window`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L79C1-L80C1) size to 3 from 10. 3. Primitive and string arrays are displayed horizontally, i.e. set [`skip_new_lines`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L90) to `false`. Uses ` | ` as the delimiter between elements with no opening/closing brackets. 4. All other array types (`struct`, `list`, etc) are displayed vertically with an `indent` of 4. **Example String Array Display:** ```matlab >> a = arrow.array(["Hello", missing, "Bye"]) a = StringArray with 3 elements and 1 null value: "Hello" | null | "Bye" ``` **Example Struct Array Display:** ```matlab >> a1 = arrow.array(["Hello", missing, "Bye"]); >> a2 = arrow.array([1 2 3]); >> structArray = arrow.array.StructArray.fromArrays(a1, a2) structArray = StructArray with 3 elements and 0 null values: -- is_valid: all not null -- child 0 type: string [ "Hello", null, "Bye" ] -- child 1 type: double [ 1, 2, 3 ] ``` ### Are these changes tested? Yes. Added a new test class called `tArrayDisplay.m` with unit tests for array display. ### Are there any user-facing changes? Yes. Users will see a different display for arrays now. ### Future Directions 1. apache#38166 * Closes: apache#38398 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
### Rationale for this change Currently, the display for `arrow.array.Array`s is not very MATLAB-like: ```matlab >> a = arrow.array([1 2 3 4]) a = [ 1, 2, 3, ] ``` At the very least, the display should include the class header and indent each line by 4 spaces. Here's one display option: ```matlab >> a = arrow.array([1 2 3 4]) a = Float64Array with 4 elements and 0 null values: 1 | 2 | 3 | 4 ``` ### What changes are included in this PR? 1. Array display now includes a class header, which states the array type and the number of elements/nulls in the array. 2. Changed the [`window`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L79C1-L80C1) size to 3 from 10. 3. Primitive and string arrays are displayed horizontally, i.e. set [`skip_new_lines`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L90) to `false`. Uses ` | ` as the delimiter between elements with no opening/closing brackets. 4. All other array types (`struct`, `list`, etc) are displayed vertically with an `indent` of 4. **Example String Array Display:** ```matlab >> a = arrow.array(["Hello", missing, "Bye"]) a = StringArray with 3 elements and 1 null value: "Hello" | null | "Bye" ``` **Example Struct Array Display:** ```matlab >> a1 = arrow.array(["Hello", missing, "Bye"]); >> a2 = arrow.array([1 2 3]); >> structArray = arrow.array.StructArray.fromArrays(a1, a2) structArray = StructArray with 3 elements and 0 null values: -- is_valid: all not null -- child 0 type: string [ "Hello", null, "Bye" ] -- child 1 type: double [ 1, 2, 3 ] ``` ### Are these changes tested? Yes. Added a new test class called `tArrayDisplay.m` with unit tests for array display. ### Are there any user-facing changes? Yes. Users will see a different display for arrays now. ### Future Directions 1. apache#38166 * Closes: apache#38398 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
dgreiss
pushed a commit
to dgreiss/arrow
that referenced
this issue
Feb 19, 2024
### Rationale for this change Currently, the display for `arrow.array.Array`s is not very MATLAB-like: ```matlab >> a = arrow.array([1 2 3 4]) a = [ 1, 2, 3, ] ``` At the very least, the display should include the class header and indent each line by 4 spaces. Here's one display option: ```matlab >> a = arrow.array([1 2 3 4]) a = Float64Array with 4 elements and 0 null values: 1 | 2 | 3 | 4 ``` ### What changes are included in this PR? 1. Array display now includes a class header, which states the array type and the number of elements/nulls in the array. 2. Changed the [`window`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L79C1-L80C1) size to 3 from 10. 3. Primitive and string arrays are displayed horizontally, i.e. set [`skip_new_lines`](https://github.com/apache/arrow/blob/37935604bf168a3b2d52f3cc5b0edf83b5783309/cpp/src/arrow/pretty_print.h#L90) to `false`. Uses ` | ` as the delimiter between elements with no opening/closing brackets. 4. All other array types (`struct`, `list`, etc) are displayed vertically with an `indent` of 4. **Example String Array Display:** ```matlab >> a = arrow.array(["Hello", missing, "Bye"]) a = StringArray with 3 elements and 1 null value: "Hello" | null | "Bye" ``` **Example Struct Array Display:** ```matlab >> a1 = arrow.array(["Hello", missing, "Bye"]); >> a2 = arrow.array([1 2 3]); >> structArray = arrow.array.StructArray.fromArrays(a1, a2) structArray = StructArray with 3 elements and 0 null values: -- is_valid: all not null -- child 0 type: string [ "Hello", null, "Bye" ] -- child 1 type: double [ 1, 2, 3 ] ``` ### Are these changes tested? Yes. Added a new test class called `tArrayDisplay.m` with unit tests for array display. ### Are there any user-facing changes? Yes. Users will see a different display for arrays now. ### Future Directions 1. apache#38166 * Closes: apache#38398 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement requested
Currently, the display for
arrow.array.Array
s is not very MATLAB-like:At the very least, the display should include the class header and indent each line by 4 spaces. Here's one display option:
Component(s)
MATLAB
The text was updated successfully, but these errors were encountered: