开发者

ThriftColumnFamilyTemplate for querying super column family and their columns

I have a cassandra data model that's super column family. There are multiple super columns and every super column has multiple columns of different type (for example quantity is integer, Id is long, and name is a string). I am able to query names of all super columns for a row using Thr开发者_如何学运维iftSuperCfTemplate. However, I am unable to retrieve the name/values of the columns of super columns. I am wondering if there are any samples available?


this is a sample from our test suite in Hector to achieve that.

More info will be posted soon in hector-client.org

@Test
public void testQuerySingleSubColumn() {
  SuperCfTemplate<String, String, String> sTemplate = 
    new ThriftSuperCfTemplate<String, String, String>(keyspace, "Super1", se, se, se);
  SuperCfUpdater sUpdater = sTemplate.createUpdater("skey3","super1");
  sUpdater.setString("sub1_col_1", "sub1_val_1");
  sTemplate.update(sUpdater);

  HColumn<String,String> myCol = sTemplate.querySingleSubColumn("skey3", "super1", "sub1_col_1", se);
  assertEquals("sub1_val_1", myCol.getValue());
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜