user2975755
user2975755

Reputation: 11

Get Cassandra partitioner

I'm using the next code, of Hector client, to get the partitioner Cassandra is using:

    CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(
            ksp, StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
    cqlQuery.setQuery("select partitioner from local");
    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);
        HColumn<String, String> column = row.getColumnSlice().getColumnByName("partitioner");
        String partitioner = column.getName();
    }

But it fails, returning a NullPointerException. I have tried the query in cqlsh and it works, but using this code not. Does anyone know what is wrong?

Thanks!

Upvotes: 1

Views: 31

Answers (0)

Related Questions