本文整理汇总了Java中org.apache.gora.cassandra.query.CassandraSuperColumn类的典型用法代码示例。如果您正苦于以下问题:Java CassandraSuperColumn类的具体用法?Java CassandraSuperColumn怎么用?Java CassandraSuperColumn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CassandraSuperColumn类属于org.apache.gora.cassandra.query包,在下文中一共展示了CassandraSuperColumn类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSuperColumns
import org.apache.gora.cassandra.query.CassandraSuperColumn; //导入依赖的package包/类
/**
* When we add supercolumns, Gora keys are mapped to Cassandra partition keys only.
* This is because we follow the Cassandra logic where column family data is
* partitioned across nodes based on row Key.
*/
private void addSuperColumns(String family, CassandraQuery<K, T> cassandraQuery,
CassandraResultSet<K> cassandraResultSet) {
List<SuperRow<K, String, ByteBuffer, ByteBuffer>> superRows = this.cassandraClient.executeSuper(cassandraQuery, family);
for (SuperRow<K, String, ByteBuffer, ByteBuffer> superRow: superRows) {
K key = superRow.getKey();
CassandraRow<K> cassandraRow = cassandraResultSet.getRow(key);
if (cassandraRow == null) {
cassandraRow = new CassandraRow<>();
cassandraResultSet.putRow(key, cassandraRow);
cassandraRow.setKey(key);
}
SuperSlice<String, ByteBuffer, ByteBuffer> superSlice = superRow.getSuperSlice();
for (HSuperColumn<String, ByteBuffer, ByteBuffer> hSuperColumn: superSlice.getSuperColumns()) {
CassandraSuperColumn cassandraSuperColumn = new CassandraSuperColumn();
cassandraSuperColumn.setValue(hSuperColumn);
cassandraSuperColumn.setFamily(family);
cassandraRow.add(cassandraSuperColumn);
}
}
}