From b0dffaf846ce528758d57ea552fbc4d507591157 Mon Sep 17 00:00:00 2001 From: tess <48131946+stress-tess@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:16:51 -0400 Subject: [PATCH] Fixes #3658: segarray with nans and empty segments hdf5 bug (#3660) This PR (closes #3658) fixes a bug when using hdf5 to write a segarray with nans and empty segments Co-authored-by: Tess Hayes --- src/HDF5Msg.chpl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/HDF5Msg.chpl b/src/HDF5Msg.chpl index 48d8662bc3..7858cbd830 100644 --- a/src/HDF5Msg.chpl +++ b/src/HDF5Msg.chpl @@ -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)); + } } /*