要求: 复合列(非DynamicComposite),Hector模板实现
您好.. 我目前正在尝试使用以下规范创建一个列家族:
somekeyId UUID
Site URL UTF8Type
Page URL UTF8Type
- parentURL UTF8Type (Composite)
- anchortext UTF8Type (Composite)
我创建了以下代码:
创建ColumnFamily:
List<ColumnDefinition> columnList = new ArrayList<ColumnDefinition>();
...
ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition(keyspaceName, "page_internal_links", ComparatorType.COMPOSITETYPE, columnList);
cfDef.setComparatorTypeAlias("(UTF8Type, UTF8Type, UTF8Type)");
cfDef.setKeyValidationClass(ComparatorType.UTF8TYPE.getTypeName());
Composite key = new Composite();
key.addComponent(parentURL, StringSerializer.get());
key.addComponent(anchorText, StringSerializer.get());
ColumnFamilyTemplate<String, Composite> compTemplate =
new ThriftColumnFamilyTemplate<String, Composite>(
ksp, "linksCF", StringSerializer.get(), CompositeSerializer.get());
ColumnFamilyUpdater<String, Composite> compUpdater = compTemplate.createUpdater("key"); // In this row key, I want to provide somekeyId UUID
// Any suggestions here ??
compTemplate.update(compUpdater);
提前感谢您的帮助。我到处都在寻找tuts / docs ..但我最终无处可去......