javastringselecthdf5hdfql

How to obtain a string type data in a dataset with HDFql in JAVA?


I'm new in HDF5 and HDFql, I'm working in java and I have a .h5 file with several groups, inside each group I have different Datasets, some are floating arrays, which I get as follows. https://gyazo.com/c10100b327d20a2db8c13f2fd9ab7668

 Double[][] values = new Double[numRow][numCol];
 HDFql.variableRegister(values);
 HDFql.execute("SELECT FROM "+gName+"/"+dName+" INTO MEMORY "+HDFql.variableGetNumber(values));
 HDFql.variableUnregister(values);

The problem occurs when I have a dataset with a variable that is 1 row and 1 column and the type of data, is String. https://gyazo.com/2622693aee83d9eba5487a053ba9247c

I have tried to implement the following codes and I get the following error message

  String[] val = new String[10];
  HDFql.variableRegister(val);
  HDFql.execute("SELECT FROM "+gName+"/"+dName+" INTO MEMORY "+HDFql.variableGetNumber(val));
  HDFql.variableUnregister(val);

and

String val = "";
HDFql.variableRegister(val);
HDFql.execute("SELECT FROM "+gName+"/"+dName+" INTO MEMORY "+HDFql.variableGetNumber(val));
HDFql.variableUnregister(val);

the error shown by the console is:

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006da2f270, pid=42048, tid=0x00000000000089d4

JRE version: Java(TM) SE Runtime Environment (8.0_211-b12) (build 1.8.0_211-b12) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.211-b12 mixed mode windows-amd64 compressed oops) Problematic frame: V [jvm.dll+0x27f270]

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as: C:\Users\us\AppData\Local\Temp\hs_err_pid42048.log

If you would like to submit a bug report, please visit:
http://bugreport.java.com/bugreport/crash.jsp

Any help is welcome, thank you very much in advance


Solution

  • Even if the dataset only has one element (in your case, 1 row x 1 col), you still need to declare the variable (that you register to store the data) as an array. In other words, declare and create variable val as follows:

    String val[] = new String[1];
    

    Additionally, please check section 5.2.51 in HDFql reference manual to know what type of variables you may register (with method variableRegister) in Java.