KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here's a sample of the scenario I'm facing. Say I have this column family: create column family CompositeTypeCF with comparator = 'CompositeType(IntegerType,UTF8Type)' and key_validation_class = 'UTF8Type' and default_validation_class = 'UTF8Type' Here's some sample Java code using Hector as to how I'd go about inserting some data into this column family: Cluster cluster = HFactory.getOrCreateCluster("Test Cluster", "192.168.1.6:9160"); Keyspace keyspaceOperator = HFactory.createKeyspace("CompositeTesting", cluster); Composite colKey1 = new Composite(); colKey1.addComponent(1, IntegerSerializer.get()); colKey1.addComponent("test1", StringSerializer.get()); Mutator<String> mutator = HFactory.createMutator(keyspaceOperator, StringSerializer.get()); Mutator<String> addInsertion = mutator.addInsertion("rowkey1", "CompositeTypeCF", HFactory.createColumn(colKey1, "Some Data", new CompositeSerializer(), StringSerializer.get())); mutator.execute(); This works, and if I go to the cassandra-cli and do a list I get this: $ list CompositeTypeCF; Using default limit of 100 ------------------- RowKey: rowkey1 => (column=1:test1, value=Some Data, timestamp=1326916937547000) My question now is this: How do I go about querying this data in Hector? Basically I would need to query it in a few ways: Give me the whole row where Row Key = "rowkey1" Give me the column data where the first part of the column name = some integer value Give me all the columns where the first part of the column name is within a certain range
Tags (comma-separated)
Save Edits
Cancel