(Quick Reference)

Counting the Number of Columns

In an Entire Row

def rowKey = "xxx-1"
int result = astyanaxService.keyspace().prepareQuery("Standard1")
    .getKey(rowKey)
    .getCount()
    .execute()
    .result

In a Slice of Columns

def rowKey = "xxx-1"
int result = astyanaxService.keyspace().prepareQuery("Standard1")
    .getKey(rowKey)
    .withColumnRange(new RangeBuilder().setStart("ColumnName1").setEnd("ColumnNameX").setMaxSize(100).build())
    .getCount()
    .execute()
    .result

Alternate Slice of Columns

def rowKey = "xxx-1"
int result = astyanaxService.keyspace().prepareQuery("Standard1")
    .getKey(rowKey)
    .withColumnRange("ColumnName1","ColumnNameN",false, 100)
    .getCount()
    .execute()
    .result