Search code examples
cassandracommand-line-interfacehector

Composite column query - with only one component specified


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

Solution

  • 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