Problem reading data from HDF5 file using

Hi @angelbillyguyon,

To support reading more than one row, the code previously posted should be modified as follows:

PROGRAM Test

    USE HDFql

    INTEGER :: state
    INTEGER :: i

    state = hdfql_execute("SELECT FROM test.h5 A1/A2/A3")

    DO WHILE(hdfql_cursor_next() == HDFQL_SUCCESS)

        WRITE(*, *) "ID=", hdfql_cursor_get_bigint()

        WRITE(*, *) "g1="
        DO i = 1, 36
            state = hdfql_cursor_next()
            WRITE(*, *) hdfql_cursor_get_double()
        END DO

        WRITE(*, *) "g2="
        DO i = 1, 9
            state = hdfql_cursor_next()
            WRITE(*, *) hdfql_cursor_get_double()
        END DO

        state = hdfql_cursor_next()
        WRITE(*, *) "g3=", hdfql_cursor_get_double()

        ! (...)

        state = hdfql_cursor_next()
        WRITE(*, *) "DOMAIN_ID=", hdfql_cursor_get_bigint()

    END DO

END PROGRAM

Since dataset A3 can potentially grow to have millions of rows, an out-of-memory exception may occur when trying to read it. To circumvent this possible exception, you need to read small chunks of A3 at the time using HDF5 hyperslabs capabilities. Therefore, the code above will need to be modified to work explicitly with hyperslabs in case A3 grows considerably. The good news is that the upcoming release of HDFql (version 2.5.0) will introduce the concept of a sliding cursor, which (implicitly/seamlessly) uses hyperslabs in case a dataset does not fit in (RAM) memory due to its sheer dimension. Please see this post for additional details about sliding cursors.

On the other hand, if you wish to use a (user-defined) variable instead of a cursor, you need to create such variable as a structure (that mimics the members of dataset A3) and pass it to HDFql when reading dataset A3 - HDFql will take care of populating the variable with data from this dataset. In addition, just like with cursors, you need to explicitly take care of reading A3 in chunks (using hyperslabs capabilities) in case it does not fit in (RAM) memory.

Hope it helps!