queryverse / queryverse/CSVFiles.jl
The streaming load/save example does not work
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 52
- Forks
- 12
- Avg merge
- 18h 21m
- Merged PRs (30d)
- 3
Description
julia> using DataFrames, CSVFiles, FileIO
julia> df = DataFrame(a = [1,2,3], b = [4,5,6]);
julia> stream = IOBuffer();
julia> fileiostream = Stream(format"CSV", stream);
julia> save(fileiostream, df)
julia> load(fileiostream)
0x0 CSV file
Error showing value of type CSVFiles.CSVStream:
ERROR: MethodError: no method matching zero(::Type{Any})
Closest candidates are:
zero(::Type{Union{Missing, T}}) where T at missing.jl:87
zero(::Type{LibGit2.GitHash}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LibGit2/src/oid.jl:220
zero(::Type{Pkg.Resolve.VersionWeights.VersionWeight}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/resolve/VersionWeights.jl:19
...
Stacktrace:
[1] zero(::Type{Any}) at ./missing.jl:87
[2] reduce_empty(::typeof(+), ::Type) at ./reduce.jl:227
[3] reduce_empty(::typeof(Base.add_sum), ::Type) at ./reduce.jl:234
[4] mapreduce_empty(::typeof(identity), ::Function, ::Type) at ./reduce.jl:251
[5] _mapreduce(::typeof(identity), ::typeof(Base.add_sum), ::IndexLinear, ::Array{Any,1}) at ./reduce.jl:305
[6] _mapreduce_dim at ./reducedim.jl:308 [inlined]
[7] #mapreduce#548 at ./reducedim.jl:304 [inlined]
[8] mapreduce at ./reducedim.jl:304 [inlined]
[9] _sum at ./reducedim.jl:653 [inlined]
[10] _sum at ./reducedim.jl:652 [inlined]
[11] #sum#550 at ./reducedim.jl:648 [inlined]
[12] sum(::Array{Any,1}) at ./reducedim.jl:648
[13] #printtable#1(::Bool, ::Function, ::IOContext{REPL.Terminals.TTYTerminal}, ::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}, ::String) at /Users/harry/.julia/packages/TableShowUtils/ImkA9/src/TableShowUtils.jl:43
[14] printtable(::IOContext{REPL.Terminals.TTYTerminal}, ::TableTraitsUtils.TableIterator{NamedTuple{(),Tuple{}},Tuple{}}, ::String) at /Users/harry/.julia/packages/TableShowUtils/ImkA9/src/TableShowUtils.jl:7
[15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::CSVFiles.CSVStream) at /Users/harry/.julia/packages/CSVFiles/KysmQ/src/CSVFiles.jl:38
[16] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::CSVFiles.CSVStream) at ./sysimg.jl:194
[17] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:131
[18] display(::REPL.REPLDisplay, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:135
[19] display(::Any) at ./multimedia.jl:287
[20] #invokelatest#1 at ./essentials.jl:742 [inlined]
[21] invokelatest at ./essentials.jl:741 [inlined]
[22] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
[23] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
[24] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
[25] #invokelatest#1 at ./essentials.jl:742 [inlined]
[26] invokelatest at ./essentials.jl:741 [inlined]
[27] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
[28] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
[29] run_repl(::REPL.AbstractREPL, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
[30] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[31] #invokelatest#1 at ./essentials.jl:742 [inlined]
[32] invokelatest at ./essentials.jl:741 [inlined]
[33] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[34] exec_options(::Base.JLOptions) at ./client.jl:284
[35] _start() at ./client.jl:436
I took a look at the tests, which include mark and reset statements. When I add these statements, it works:
julia> stream = IOBuffer();
julia> fileiostream = Stream(format"CSV", stream);
julia> mark(stream)
0
julia> save(fileiostream, df)
julia> reset(stream)
0
julia> mark(stream)
0
julia> load(fileiostream)
3x2 CSV file
a │ b
──┼──
1 │ 4
2 │ 5
3 │ 6
Weirdly, that works in the REPL, but not in Atom, where I get the same stacktrace as above.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the streaming example using Stream(format"CSV", stream), save, and load, then compare it with the tests that use mark and reset. Inspect the CSVFiles.jl show entry point at line 38 and reproduce the behavior in both the REPL and Atom; done means the example works without the reported zero(::Type{Any}) failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100