Skip to content

Uninitialized variable length sequences are returned as scalars instead of empty arrays #321

@mattjala

Description

@mattjala

When reading from elements in a dataset of variable-length type, uninitialized elements are returned as scalars. With the library API, uninitialized vlen types are considered to be length-zero arrays.

Test program in C to generate an erroneous response from HSDS using the REST VOL:

int main() {
  #define COUNT 10
  hid_t file_id = H5I_INVALID_HID;
  hid_t dset_id = H5I_INVALID_HID;
  hvl_t rbuf[COUNT];
  const hsize_t dims[] = {COUNT};

  hid_t vlen_id = H5Tvlen_create(H5T_NATIVE_INT);

  file_id = H5Fcreate("/home/test_user1/tfile.c", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
  hid_t space_id = H5Screate_simple(1, dims, NULL);
  
  dset_id = H5Dcreate2(file_id, "dset_vlen", vlen_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
  H5Dread(dset_id, vlen_id, space_id, H5S_ALL, H5P_DEFAULT, (void*) rbuf);
  
  H5Treclaim(vlen_id, space_id, H5P_DEFAULT, (void*) rbuf);
}

Server response:

{..."value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ...}

Expected response:

{..."value": [[], [], [], [], [], [], [], [], [], []], ...}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions