Skip to content

Commit

Permalink
add show method for Parquet.Table
Browse files Browse the repository at this point in the history
Add a custom `show` method for Parquet.Table, to avoid invoking the default `show` method that triggers a load of data.
  • Loading branch information
tanmaykm committed Mar 3, 2021
1 parent c3337a9 commit 7184fcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,7 @@ function show(io::IO, par::Parquet.File)
println(io, " created by: $(meta.created_by)")
println(io, " cached: $(length(par.page_cache.refs)) column chunks")
end

function show(io::IO, table::Parquet.Table)
println(io, "Parquet.Table(\"$(getfield(table, :path))\")")
end
4 changes: 4 additions & 0 deletions test/test_load.jl
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ function test_load_file()
partitions = Tables.partitions(table)
@test length(partitions) == 10
@test length(collect(partitions)) == 10

iob = IOBuffer()
show(iob, table)
@test startswith(String(take!(iob)), "Parquet.Table(")
end
end

Expand Down

0 comments on commit 7184fcb

Please sign in to comment.