Create a composite column in Kassandra using the Hector template

Requirements: Composite column (not DynamicComposite), implementation of the Hector template

Hi .. I am currently trying to create a column with the following characteristics:

somekeyId UUID Site URL UTF8Type Page URL UTF8Type - parentURL UTF8Type (Composite) - anchortext UTF8Type (Composite) 

I created the following code:

Create 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); 

Thanks for the help in advance. I searched for tuts / docs all over the place. But I was nowhere ...

+4
source share

Source: https://habr.com/ru/post/1393005/


All Articles