I have built a table using CQL2, data looks fine from cqlsh as well as hive command prompt. But when I am reading the data from java client it shows up binary value for 2 columns, as shown below
"hr1":"\u0000\u0000\u0000\u000e","hr2":"\u0000\u0000\u0000)"
After creating table have created index on column "col1" from CQL prompt.
My java code looks like :
public void read() {
if (null != cluster && null != keySpace) {
CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(
keySpace, StringSerializer.get(), StringSerializer.get(),
StringSerializer.get());
cqlQuery.setQuery("select * from myTable where col1 = 'HR100'");
QueryResult<CqlRows<String, String, String>> result = cqlQuery
.execute();
CqlRows rows = result.get();
for (int i = 0; i < rows.getCount(); i++) {
RowImpl<String, String, String> row = (RowImpl<String, String, String>) rows
.getList().get(i);
System.out.println("Row key = " + row.getKey());
for (HColumn<String, String> column : row.getColumnSlice()
.getColumns()) {
System.out.println("Column name = "
+ column.getName().toString());
System.out.println("Colmn value = "
+ column.getValue().toString());
}
}
}
}