1

I have a ColumnFamily with a composite column which has 2 integer columns in it. I would like to query that column family with Hector with only one one component specified. Is it possible? I have tried this but it is not returning any result

        MultigetSliceQuery<String, Composite, Object> msq = HFactory.createMultigetSliceQuery(dealsReadKeySpace,stringSerializer, compSerializer, objSerializer);
        msq.setKeys(keysList);

        Composite start = new Composite();

        start.addComponent(searchParameter.getStarRating(), intSerializer);

        msq.setColumnNames(start);
        QueryResult<Rows<String, Composite, Object>> result = msq.execute();
Vinay Kumar Chella
  • 1,719
  • 6
  • 23
  • 35

1 Answers1

3

You need to specify all component values when constructing the start value. I suggest you use a value for the second integer component that is one of:

  • The known minimum of that second value
  • An integer so small that you are positive (no pun intended) that it is smaller than any second value of any composite column name, or
  • The smallest possible integer
Chris Gerken
  • 16,221
  • 6
  • 44
  • 59
  • addComponent can take a 3rd argument, which specifies equality to be used: Equal, GreaterThanEqual, LessThanEqual. See [here](http://www.datastax.com/dev/blog/introduction-to-composite-columns-part-1). Plus [this question and answer](http://stackoverflow.com/questions/8916820/querying-compositetype-columns-in-cassandra-using-hector) might help – libjack Oct 02 '12 at 14:07