As you may be aware I've been trying to track down a problem using JDBC 1.1.2 
with Cassandra 1.2.0  I was getting a null pointer exception in the result set. 
 I've done some digging into the JDBC driver  and found the following.

In CassandraResultSet.java the new result set is Instantiated in 
    
CassandraResultSet(Statement statement, CqlResult resultSet, String keyspace)

I decided to trace the result set with the following code:

rowsIterator = resultSet.getRowsIterator();
        System.out.println("-------------------------------");
        while(rowsIterator.hasNext()){
           CqlRow row = rowsIterator.next();
           curRowKey = row.getKey();
           System.out.println("Row Key "+curRowKey);
           List<Column> cols = row.getColumns();
           Iterator<Column> iterator;
           iterator = cols.iterator();     
           while (iterator.hasNext()){
               Column col=(Column)iterator.next();
               String Name= new String(col.getName());
               String Value = new String(col.getValue());
               System.out.println("Col "+Name+ " : "+Value);
                }
        }

This produced the following output:

-------------------------------
Row Key [B@617e53c9
Col key : jsmith
Col  : 
Col password : ch@ngem3a
Row Key [B@2caee320
Col key : jbrown
Col  : 
Col gender : male
-------------------------------

As you can see there is a black column at position 2 in each of the rows.  As 
this resultset has come from the Cassandra thrift client ( I believe) the 
problem amy lay there.  There is no blank column defined by my SQL create 
statements I believe. 

If I'm correct here, should I raise a ticket with JDBC or Cassandra ? (for now 
I've patched my local JDBC driver so it doesn't create a TypedColumn if the 
result set produces a null column)

Andy


The University of Dundee is a Scottish Registered Charity, No. SC015096.


Reply via email to