(Quick Reference)
Querying for a Slice of Columns
Standard Astyanax
Returns
com.netflix.astyanax.model.ColumnList<String>def rowKey = "xxx-1"
def result = astyanaxService.keyspace().prepareQuery("Standard1")
.getKey(rowKey)
.withColumnRange(new RangeBuilder().setStart("ColumnName1").setEnd("ColumnNameX").setMaxSize(100).build())
.execute()
.result
Alternate Form
Returns
com.netflix.astyanax.model.ColumnList<String>def rowKey = "xxx-1"
def result = astyanaxService.keyspace().prepareQuery("Standard1")
.getKey(rowKey)
.withColumnRange("ColumnName1","ColumnNameN",false, 100)
.execute()
.result
Return a Map of Columns
Returns java.util.Map<String,
com.netflix.astyanax.model.Column<String>>
def rowKey = "xxx-1"
def result = astyanaxService.keyspace().prepareQuery("Standard1")
.getKey(rowKey)
.withColumnRange("ColumnName1","ColumnNameN",false, 100)
.execute()
.result
.toMap()
Return a Map of Strings
Returns java.util.Map<String, String>
def rowKey = "xxx-1"
def result = astyanaxService.keyspace().prepareQuery("Standard1")
.getKey(rowKey)
.withColumnRange("ColumnName1","ColumnNameN",false, 100)
.execute()
.result
.toStringMap()
Return a Map of Longs
Returns java.util.Map<String, Long>
def rowKey = "xxx-1"
def result = astyanaxService.keyspace().prepareQuery("Counter1")
.getKey(rowKey)
.withColumnRange("ColumnName1","ColumnNameN",false, 100)
.execute()
.result
.toLongMap()