Skip to content

Commit

Permalink
Fixes #3658: segarray with nans and empty segments hdf5 bug (#3660)
Browse files Browse the repository at this point in the history
This PR (closes #3658) fixes a bug when using hdf5 to write a segarray with nans and empty segments

Co-authored-by: Tess Hayes <stress-tess@users.noreply.github.com>
  • Loading branch information
stress-tess and stress-tess committed Aug 14, 2024
1 parent 689e779 commit b0dffaf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/HDF5Msg.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -1225,10 +1225,15 @@ module HDF5Msg {
*/
private proc writeSegmentedComponentToHdf(fileId: int, group: string, component: string, ref items: [] ?etype) throws {
var numItems = items.size: uint(64);
C_HDF5.H5LTmake_dataset_WAR(fileId, "/%s/%s".format(group, component).c_str(), 1,
if numItems > 0 {
C_HDF5.H5LTmake_dataset_WAR(fileId, "/%s/%s".format(group, component).c_str(), 1,
c_ptrTo(numItems), getDataType(etype), c_ptrTo(items));

writeArkoudaMetaData(fileId, "%s/%s".format(group, component), "pdarray", getDataType(etype));
writeArkoudaMetaData(fileId, "%s/%s".format(group, component), "pdarray", getDataType(etype));
}
else {
// writeOffsets=false because they will be written after
writeNilSegmentedGroupToHdf(fileId, group, false, getDataType(etype));
}
}

/*
Expand Down

0 comments on commit b0dffaf

Please sign in to comment.