Skip to content
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

[BREAKING] Circular ref bug show #2200

Merged
merged 9 commits into from
Apr 27, 2020

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Apr 20, 2020

Fixes #2135

This is not a full fix, as Base is much better at detecting circular references, but doing it right would require a much bigger rewrite of the code. Now we correctly handle 1-level of indirection (but do not correctly handle a case when e.g. a data frame would contain a vector containing a dict containing the original data frame - but I think this case is so obscure that it can be skipped).

Additionally now we:

  1. always print missing, nothing and #undef consistently everywhere (text, LaTeX, HTML, CSV, TSV) - the only restriction I left is CSV and TSV throwing an error when trying to write #undef
  2. consistently highlight missing, nothing and #undef everywhere (text, LaTeX, HTML) - so they are never mixed up with strings
  3. if a AbstractDataFrame, DataFrameRow, DataFrameRows, DataFrameColumns or GroupedDataFrame is stored in a data frame then only its summary is printed (this makes printing much nicer (otherwise the output were not readable anyway) - and as a side effect - avoids the original circular reference problem)

Finally this PR fixes a problem that old printing mechanism in DataFrames.jl was not thread safe. After fixing it is thread safe (we do not reuse one global buffer but allocate it anew for each top-level call of show).

This PR is largely orthogonal to #2199 and can be merged post 0.21 release, but before 1.0 release as it is mildly breaking.

@bkamins bkamins added the breaking The proposed change is breaking. label Apr 20, 2020
@bkamins bkamins added this to the 1.0 milestone Apr 20, 2020
@bkamins bkamins added the bug label Apr 20, 2020
Copy link
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Thanks. I wonder whether we couldn't just adapt the show method for data frames so that they check :compact or :limited and show only the summary in that case.

@bkamins
Copy link
Member Author

bkamins commented Apr 22, 2020

I wonder whether we couldn't just adapt the show method for data frames so that they check :compact or :limited and show only the summary in that case.

I would leave it for a separate PR (as it probably will lead to a cascade of other things to check - I am just not sure that I can get it 100% right then - these show-related PRs are hairy if we want to consistently support all MIME types).

@bkamins
Copy link
Member Author

bkamins commented Apr 22, 2020

All suggestions are applied. I think the major decision is what to do with nothing.

@bkamins
Copy link
Member Author

bkamins commented Apr 24, 2020

Thank you. I will merge it after #2911 is done.

@bkamins bkamins merged commit 2d6d8ce into JuliaData:master Apr 27, 2020
@bkamins bkamins deleted the circular_ref_bug_show branch April 27, 2020 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking The proposed change is breaking. bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Circular reference in DataFrame bug
2 participants