2
votes

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 ThriftSuperCfTemplate. However, I am unable to retrieve the name/values of the columns of super columns. I am wondering if there are any samples available?

1

1 Answers

1
votes

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());
}