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

add shorter show method for AbstractColumns #236

Merged
merged 3 commits into from
Apr 13, 2021
Merged

add shorter show method for AbstractColumns #236

merged 3 commits into from
Apr 13, 2021

Conversation

ericphanson
Copy link
Contributor

@ericphanson ericphanson commented Apr 7, 2021

For example,

julia> big_tbl = (; a = [rand(100) for _ = 1:200], b = [rand(100) for _ = 1:200], c = [rand(100) for _ = 1:200]);

julia> tbl = Arrow.Table(Arrow.tobuffer(big_tbl))
Arrow.Table with 200 rows, 3 columns, and schema:
 :a  Vector{Float64} (alias for Array{Float64, 1})
 :b  Vector{Float64} (alias for Array{Float64, 1})
 :c  Vector{Float64} (alias for Array{Float64, 1})

This table used to print as 1.2M characters! (The “alias” printing is removed with JuliaLang/julia#39256 I believe).

I tried to be pretty safe here since AbstractColumns are very general, and I'm not sure if we can expect columns to have a length for example.

I decided to print the schema instead of a manual column printing as in apache/arrow-julia#168, since we don't have the eltype info in general (columntypes just asks the schema, so the fallback method only works when we have a schema), and I think maybe if Tables doesn't have a schema that can be useful info to pass along to the user (perhaps they can add one and improve performance in some cases).

@codecov
Copy link

codecov bot commented Apr 7, 2021

Codecov Report

Merging #236 (212777c) into main (8ed01b2) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #236      +/-   ##
==========================================
+ Coverage   94.51%   94.59%   +0.07%     
==========================================
  Files           7        7              
  Lines         602      610       +8     
==========================================
+ Hits          569      577       +8     
  Misses         33       33              
Impacted Files Coverage Δ
src/Tables.jl 87.50% <100.00%> (+0.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ed01b2...212777c. Read the comment docs.

src/Tables.jl Outdated Show resolved Hide resolved
Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

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

Thanks @ericphanson !

@quinnj quinnj merged commit c2be513 into JuliaData:main Apr 13, 2021
@ericphanson ericphanson deleted the eph/show branch April 13, 2021 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants