arrow-julia icon indicating copy to clipboard operation
arrow-julia copied to clipboard

Invalid argument error

Open zhwwng opened this issue 3 years ago • 0 comments

If you try to save a loaded table into the same file, it will lead to an invalid argument error.

Seems like it's caused by mmap on windows. See JuliaData/CSV.jl#170.

using Arrow
using DataFrames

df = DataFrame(rand(100, 100), :auto)
Arrow.write("test.arrow", df)

df = Arrow.Table("test.arrow")
Arrow.write("test.arrow", df)

The last line will raise an error.

ERROR: SystemError: opening file "test.arrow": Invalid argument
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base .\error.jl:174
  [2] #systemerror#68
    @ .\error.jl:173 [inlined]
  [3] systemerror
    @ .\error.jl:173 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Bool, append::Nothing)
    @ Base .\iostream.jl:293
  [5] open(fname::String, mode::String; lock::Bool)
    @ Base .\iostream.jl:355
  [6] open(fname::String, mode::String)
    @ Base .\iostream.jl:355
  [7] open(::Arrow.var"#116#117"{Nothing, Nothing, Bool, Nothing, Bool, Bool, Bool, Int64, Int64, Float64, Bool, Arrow.Table}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\io.jl:328
  [8] open(::Function, ::String, ::String)
    @ Base .\io.jl:328
  [9] #write#115
    @ C:\Users\R9000K\.julia\packages\Arrow\SFb8h\src\write.jl:57 [inlined]
 [10] write(file_path::String, tbl::Arrow.Table)
    @ Arrow C:\Users\R9000K\.julia\packages\Arrow\SFb8h\src\write.jl:57
 [11] top-level scope
    @ Untitled-1:8

However, it works when saved under a different file name other than the original one.

Arrow.write("test1.arrow", df)

zhwwng avatar Sep 07 '22 12:09 zhwwng