Skip to content

Commit 50e8063

Browse files
authored
Merge pull request #195 from JuliaIO/nz/match-zarr-python-zstd-hotfix
Zstd: Don't persist the checksum param if false
2 parents d39d6de + 1da6046 commit 50e8063

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Compressors/zstd.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ function zcompress(a, z::ZstdCompressor)
4040
encode(z.config, reinterpret(UInt8, vec(a)))
4141
end
4242

43-
JSON.lower(z::ZstdCompressor) = Dict("id"=>"zstd", "level" => z.config.compressionLevel, "checksum" => z.config.checksum)
43+
function JSON.lower(z::ZstdCompressor)
44+
# Matching behavior in zarr-python to work with TensorStore
45+
# Ref https://github.com/JuliaIO/Zarr.jl/issues/193
46+
# Hotfix for https://github.com/zarr-developers/zarr-python/issues/2647
47+
if z.config.checksum
48+
Dict("id"=>"zstd", "level" => z.config.compressionLevel, "checksum" => z.config.checksum)
49+
else
50+
Dict("id"=>"zstd", "level" => z.config.compressionLevel)
51+
end
52+
end
4453

4554
Zarr.compressortypes["zstd"] = ZstdCompressor

0 commit comments

Comments
 (0)