Skip to content

Ragged arrays can't be read back in #211

@MaHaWo

Description

@MaHaWo

The following code derived from the tutorial fails with an error message related to type conversions:

 z = Zarr.zcreate(Vector{Int}, 4, path="./test")

z[1:3] = [[1,3,5],[4],[7,9,14]];

z[:] # this works fine 

z = nothing 

z = Zarr.zopen("./test")

z[1] # this fails 

the error message reads:

MethodError: Cannot `convert` an object of type Vector{Int64} to an object of type Int64
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, !Matched::EzXML.NodeType) where T<:Integer
   @ EzXML ~/.julia/packages/EzXML/2xuPL/src/node.jl:36
  convert(::Type{T}, !Matched::EzXML.ReaderType) where T<:Integer
   @ EzXML ~/.julia/packages/EzXML/2xuPL/src/streamreader.jl:74
  convert(::Type{T}, !Matched::AbstractChar) where T<:Number
   @ Base char.jl:185
  ...


Stacktrace:
  [1] setindex!(A::Memory{Int64}, x::Vector{Int64}, i1::Int64)
    @ Base ./genericmemory.jl:243
  [2] unsafe_copyto!(dest::Memory{Int64}, doffs::Int64, src::Memory{Vector{Int64}}, soffs::Int64, n::Int64)
    @ Base ./genericmemory.jl:153
  [3] unsafe_copyto!
    @ ./genericmemory.jl:133 [inlined]
  [4] _copyto_impl!
    @ ./array.jl:308 [inlined]
  [5] copyto!
    @ ./array.jl:294 [inlined]
  [6] copyto!
    @ ./array.jl:319 [inlined]
  [7] zuncompress!(data::Vector{Int64}, compressed::Vector{UInt8}, c::Zarr.BloscCompressor, f::Tuple{Zarr.VLenArrayFilter{Int64}})
    @ Zarr ~/.julia/packages/Zarr/3QSdj/src/Compressors.jl:37
  [8] uncompress_raw!(a::Vector{Int64}, z::Zarr.ZArray{Int64, 1, Zarr.BloscCompressor, Zarr.DirectoryStore}, curchunk::Vector{UInt8})
    @ Zarr ~/.julia/packages/Zarr/3QSdj/src/ZArray.jl:261
  [9] uncompress_to_output!(aout::Vector{Int64}, output_base_offsets::Tuple{Int64}, z::Zarr.ZArray{Int64, 1, Zarr.BloscCompressor, Zarr.DirectoryStore}, chunk_compressed::Vector{UInt8}, current_chunk_offsets::Tuple{Int64}, a::Vector{Int64}, indranges::Tuple{UnitRange{Int64}})
    @ Zarr ~/.julia/packages/Zarr/3QSdj/src/ZArray.jl:270
 [10] readblock!(aout::Vector{Int64}, z::Zarr.ZArray{Int64, 1, Zarr.BloscCompressor, Zarr.DirectoryStore}, r::CartesianIndices{1, Tuple{UnitRange{Int64}}})
    @ Zarr ~/.julia/packages/Zarr/3QSdj/src/ZArray.jl:178
 [11] readblock!
    @ ~/.julia/packages/Zarr/3QSdj/src/ZArray.jl:247 [inlined]
 [12] getindex_disk
    @ ~/.julia/packages/DiskArrays/WgDSb/src/indexing.jl:54 [inlined]
 [13] getindex(a::Zarr.ZArray{Int64, 1, Zarr.BloscCompressor, Zarr.DirectoryStore}, i::Int64)
    @ DiskArrays ~/.julia/packages/DiskArrays/WgDSb/src/indexing.jl:312
 [14] top-level scope

I'm using Julia v1.11.6 with Zarr.jl v0.9.4

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