Skip to content

Loading complex types seems to be broken with the latest HDF5_jll release #281

@rgaudette

Description

@rgaudette

With the latest HDF5_jll release it seems that loading JLD files is broken. I can successfully run the example described in the Types and their definitions section. But, if I make the example a little more complex by adding a sparse matrix to the example, I am not able to load the data I have just written. To be more specific, if I define MyTypes as:

module MyTypes
export MyType
using SparseArrays
struct MyType
    value::Int
    s_array::SparseMatrixCSC
end
end

create a an instance of a MyType with

using SparseArrays
using MyTypes
x = MyType(3, spdiagm(-1 => [1,2,3,4], 1 => [4,3,2,1]))

saving the instance with

jldopen("somedata.jld", "w") do file
    addrequire(file, MyTypes)
    write(file, "x", x)
end

appears work fine.

But when trying to load it back in with
d = JLD.load("somedata.jld")
I receive the following error:

ERROR: stored type MyTypes.MyType does not match currently loaded type
Stacktrace:
 [1] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\jld_types.jl:723
 [2] read(::JLD.JldDataset) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:367
 [3] read(::JLD.JldFile, ::String) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:343
 [4] #43 at .\none:0 [inlined]
 [5] iterate at .\generator.jl:47 [inlined]
 [6] collect_to!(::Array{Tuple{String,Integer},1}, ::Base.Generator{Array{String,1},JLD.var"#43#45"{JLD.JldFile}}, ::Int64, ::Int64) at .\array.jl:732
 [7] collect_to!(::Array{Tuple{String,UInt32},1}, ::Base.Generator{Array{String,1},JLD.var"#43#45"{JLD.JldFile}}, ::Int64, ::Int64) at .\array.jl:740
 [8] collect_to_with_first!(::Array{Tuple{String,UInt32},1}, ::Tuple{String,UInt32}, ::Base.Generator{Array{String,1},JLD.var"#43#45"{JLD.JldFile}}, ::Int64) at .\array.jl:710
 [9] collect(::Base.Generator{Array{String,1},JLD.var"#43#45"{JLD.JldFile}}) at .\array.jl:691
 [10] (::JLD.var"#42#44")(::JLD.JldFile) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:1246
 [11] jldopen(::JLD.var"#42#44", ::String, ::Vararg{String,N} where N; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:243
 [12] jldopen(::Function, ::String, ::String) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:241
 [13] load(::FileIO.File{FileIO.DataFormat{:JLD}}) at C:\Users\rick\.julia\packages\JLD\jeGJb\src\JLD.jl:1245
 [14] load(::String; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\rick\.julia\packages\FileIO\2fEu2\src\loadsave.jl:136
 [15] load(::String) at C:\Users\rick\.julia\packages\FileIO\2fEu2\src\loadsave.jl:136
 [16] top-level scope at REPL[10]:1

I also tried adding a addrequire(file, SparseArrays) to the do block and that produced the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions