Skip to content

Commit

Permalink
also disable chunking for StructArrays if compress==0
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-kats committed Mar 11, 2024
1 parent 84e2e62 commit 2b3cffa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/hdf5_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,16 @@ function write_impl(
for (i, (fname, ftype)) in enumerate(zip(fieldnames(ety), fieldtypes(ety)))
HDF5.API.h5t_insert(dtype, string(fname), fieldoffset(ety, i), _datatype(ftype))
end
chunksize = HDF5.heuristic_chunk(data)
dims = size(data)
if extensible
dims = (size(data), Tuple(-1 for _ in 1:ndims(data)))
if compress > 0x0 && ndims(data) > 0
chunksize = HDF5.heuristic_chunk(data)
dims = size(data)
if extensible
dims = (size(data), Tuple(-1 for _ in 1:ndims(data)))
end
dset = create_dataset(parent, name, dtype, dataspace(dims), chunk=chunksize, shuffle=true, deflate=compress, kwargs...)
else
dset = create_dataset(parent, name, dtype, dataspace(dims), chunk=chunksize, kwargs...)
end
dset = create_dataset(parent, name, dtype, dataspace(dims), chunk=chunksize, deflate=compress, kwargs...)
write_dataset(dset, dtype, [val for row in data for val in row])
end

Expand Down

4 comments on commit 2b3cffa

@ilia-kats
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Changing package repo URL not allowed, please submit a pull request with the URL change to the target registry and retry.

@ilia-kats
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102653

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 2b3cffa9b3255a29453fb0e0139355b78aa6605a
git push origin v0.2.0

Please sign in to comment.