当前位置: 首页>>代码示例>>Java>>正文


Java CassandraSuperColumn类代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:28,代码来源:CassandraStore.java


注:本文中的org.apache.gora.cassandra.query.CassandraSuperColumn类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。