Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Oct 2, 2020

This adds some logic for handling dictionary arrays when pretty printing batches. Part of a larger set of work I am working on for better DictionaryArray handling: https://issues.apache.org/jira/browse/ARROW-10159

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really grok why the error messages refer to repl in this file, but I have carried forward the tradition with this PR

Copy link
Contributor

@paddyhoran paddyhoran Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this (pretty printing) was part of DataFusion's cli to begin with but was moved into arrow as it was generally useful. I don't understand repl in this context either. I suggest updating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update the messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this pub so I could call it from datafusion/src/test/sql.rs which currently has a copy/pasted version of pretty printing in array_str: https://github.com/apache/arrow/blob/master/rust/datafusion/tests/sql.rs#L646

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #8333

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason / need to clone to column when printing each value

@github-actions
Copy link

github-actions bot commented Oct 2, 2020

@jhorstmann
Copy link
Contributor

Changes look good to me, but I'm wondering now how the existing code handles null values in the primitive arrays. Seems to me that would print the default value. For Utf8 I think it works kinda implicitly because of how the offsets for null values are layed out.

Would it make sense to fix this in the same PR or should I open a separate ticket?

@alamb
Copy link
Contributor Author

alamb commented Oct 3, 2020

@jhorstmann

Changes look good to me, but I'm wondering now how the existing code handles null values in the primitive arrays. Seems to me that would print the default value. For Utf8 I think it works kinda implicitly because of how the offsets for null values are layed out.

Yes you are correct (that the behavior is incorrect). Good point. I opened https://issues.apache.org/jira/browse/ARROW-10169 and #8332

jorgecarleitao pushed a commit that referenced this pull request Oct 3, 2020
Null values should be printed as "" when pretty printing. Prior to this PR, , null values in primitive arrays  were rendered as the type's default value as pointed out by @jhorstmann  on #8331 (comment)

Closes #8332 from alamb/alamb/ARROW-10169-fix-null-in-pretty-print

Authored-by: alamb <[email protected]>
Signed-off-by: Jorge C. Leitao <[email protected]>
@alamb alamb force-pushed the alamb/ARROW-10162-pretty-dictionary branch from 7201e2a to d27b581 Compare October 4, 2020 10:51
@alamb
Copy link
Contributor Author

alamb commented Oct 4, 2020

Rebased to resolve conflicts

@alamb alamb deleted the alamb/ARROW-10162-pretty-dictionary branch October 26, 2020 20:04
alamb added a commit to apache/arrow-rs that referenced this pull request Apr 20, 2021
Null values should be printed as "" when pretty printing. Prior to this PR, , null values in primitive arrays  were rendered as the type's default value as pointed out by @jhorstmann  on apache/arrow#8331 (comment)

Closes #8332 from alamb/alamb/ARROW-10169-fix-null-in-pretty-print

Authored-by: alamb <[email protected]>
Signed-off-by: Jorge C. Leitao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants