That code resulted in the following NPE.
java.lang.NullPointerException at me.prettyprint.cassandra.service.ColumnSliceIterator.next(ColumnSliceIterator.java:105)
Being new to both Cassandra and Hector, I immediately assumed that there was a problem with my query. I spent a good bit of time debugging before I realized what was happening. The internal iterator in ColumnSliceIterator is not initialized until hasNext is called. This seems like a bug to me and sure enough I found this issue. It does not look like there are any plans to fix this bug, but fortunately it can be worked around easily enough. Changing my code to,
did the trick. Going forward, I will probably wrap ColumnSliceIterator in an Iterable so that I can use it with Java's for-each loop. This will encapsulate the bug and allow me to better control the paging. This bug kept me up late the other night; so, I thought it worth a short post. Overall my experience with Hector thus far has been really good. It does a nice job of encapsulating Cassandra's Thrift APIs.