Skip to content

Working with compressed values

elandau edited this page Jul 23, 2013 · 2 revisions

Astyanax provides a serializer that can be used to read and write Snappy compressed values to a column.

Writing compressed values

MutationBatch m = keyspace.prepareMutationBatch();
m.withRow(CF_STANDARD1, "RowKey")
    .putColumn("Column1", "Value to be compressed", SnappyStringSerializer.get(), null);
OperationResult<Void> result = m.execute();

Reading compressed values

ColumnList<String> result = keyspace.prepareQuery(CF_STANDARD1)
    .getKey("RowKey")
    .execute().getResult();
String value = result.getValue("Column1", SnappyStringSerializer.get(), null);
Clone this wiki locally