-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
GH-38916: [R] Simplify dataset and table print output #38917
Conversation
|
I see this still has some tests failing...just making sure you weren't waiting on any of us for a review! |
Nah, life has just been busy, but thanks for checking in on it. I'll ping you once I get time to take a look at it again! |
789d104
to
9fb4e27
Compare
@paleolimbot This is now ready for review; mind giving this a look over when you get the chance? |
print_schema_fields <- function(s, truncate = FALSE, max_fields = 20) { | ||
if (truncate && length(s$fields) > max_fields) { | ||
fields_out <- paste(map_chr(s$fields[1:max_fields], ~ .$ToString()), collapse = "\n") | ||
fields_out <- paste0(fields_out, "\n...\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know how many fields we're not showing here? Rather than ...
, giving a count of hidden fields would be a nice improvement. I'm thinking about how pillar does it:
> starwars
# A tibble: 87 × 14
name height mass hair_color skin_color eye_color birth_year sex gender homeworld species films vehicles
<chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <lis> <list>
1 Luke Skywalk… 172 77 blond fair blue 19 male mascu… Tatooine Human <chr> <chr>
2 C-3PO 167 75 NA gold yellow 112 none mascu… Tatooine Droid <chr> <chr>
3 R2-D2 96 32 NA white, bl… red 33 none mascu… Naboo Droid <chr> <chr>
4 Darth Vader 202 136 none white yellow 41.9 male mascu… Tatooine Human <chr> <chr>
5 Leia Organa 150 49 brown light brown 19 fema… femin… Alderaan Human <chr> <chr>
6 Owen Lars 178 120 brown, gr… light blue 52 male mascu… Tatooine Human <chr> <chr>
7 Beru Whitesu… 165 75 brown light blue 47 fema… femin… Tatooine Human <chr> <chr>
8 R5-D4 97 32 NA white, red red NA none mascu… Tatooine Droid <chr> <chr>
9 Biggs Darkli… 183 84 black light brown 24 male mascu… Tatooine Human <chr> <chr>
10 Obi-Wan Keno… 182 77 auburn, w… fair blue-gray 57 male mascu… Stewjon Human <chr> <chr>
# ℹ 77 more rows
# ℹ 1 more variable: starships <list>
# ℹ Use `print(n = ...)` to see more rows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks @thisisnic. I see this as a nice improvement and don't see any issues with it. I left a few notes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I have a few minor comments, but nothing major.
I'm not at all opposed to merging this since it's an improvement, but I think #32110 will be the big win here for most end users.
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit ac1708c. There was 1 benchmark result with an error:
There was 1 benchmark result indicating a performance regression:
The full Conbench report has more details. It also includes information about 19 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
When printing objects with data with lots of rows, the output is long and unwieldy.
What changes are included in this PR?
Are these changes tested?
Yes
Are there any user-facing changes?
Yes
Before:
After: