开发者

ThriftColumnFamilyTemplate for querying super column family and their columns

开发者 https://www.devze.com 2023-04-11 03:28 出处:网络
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,

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

精彩评论

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

关注公众号