java - Hector inserting only part of the primary key -
i have query in legacy code want understand. cassandra table this:
cqlsh:mykeyspace> desc table "logtable" create table mykeyspace."logtable" ( key text, key2 text, column1 text, column2 text, column3 text, column4 text, value blob, primary key ((key, key2), column1, column2, column3, column4) )
i'm not kidding, columns named that, each column can used in way. makes code difficult read. now, there's code in java don't understand:
private static final stringserializer ss = stringserializer.get(); public void logprogressmetadata(string affiliationid, string datasetid, string jobid, progressmetadata metadata) { composite rowkey = new composite(); rowkey.addcomponent("job_progress", ss); composite column = new composite(); column.addcomponent(affiliationid, ss); column.addcomponent(datasetid, ss); column.addcomponent(jobid, ss); mutator<composite> mutator = hfactory.createmutator(keyspace, compositeserializer.get()); mutator.addinsertion(rowkey, log_cf, hfactory.createcolumn(column, metadata.tojson(), compositeserializer.get(), ss)); mutator.execute(); }
my question code regarding rowkey: placed in "key" , "key2"? if try make query in cql specifying key , not key2, error. if query without restrictions (select * "logtable"), cannot find column containing "job_progress" example, have figure out code.
thanks, serban
Comments
Post a Comment