JuliaData / Feather.jl

Read and write feather files in pure Julia
https://juliadata.github.io/Feather.jl/stable
Other
109 stars 27 forks source link

cannot write empty feather file #90

Open visr opened 6 years ago

visr commented 6 years ago

Was a bit surprised by this, since for CSV it is not an issue. This is on Feather.jl v0.4.0:

julia> using DataFrames, Feather, CSV

julia> CSV.write("empty.CSV", DataFrame(a=Int[]))
CSV.Sink{Nothing,DataType}(    CSV.Options:
        delim: ','
        quotechar: '"'
        escapechar: '\\'
        missingstring: ""
        dateformat:
        decimal: '.'
        truestring: 'true'
        falsestring: 'false'
        internstrings: true, IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1), "empty.CSV", 2, true, ["a"], 1, false, Val{false})

julia> Feather.write("empty.feather", DataFrame(a=Int[]))
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] getindex at .\array.jl:731 [inlined]
 [2] writecolumn(::Feather.Sink, ::String) at C:\Users\visser_mn\.julia\packages\Feather\fGqdB\src\sink.jl:95
 [3] writecolumns(::Feather.Sink) at C:\Users\visser_mn\.julia\packages\Feather\fGqdB\src\sink.jl:97
 [4] close!(::Feather.Sink) at C:\Users\visser_mn\.julia\packages\Feather\fGqdB\src\sink.jl:111
 [5] write(::String, ::DataFrame) at C:\Users\visser_mn\.julia\packages\Feather\fGqdB\src\sink.jl:50
 [6] top-level scope at none:0

julia> versioninfo()
Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
ExpandingMan commented 6 years ago

Looks like we have lots of problems with empty arrays as we cannot even define arrow formatted arrays of 0-length. I don't think there's a fundamental reason for this and it should be possible. We'll have to work on this.