/** * Filter the output of the constraint for the specified column and only return results that have * the specified value. * * @param constraint * @param columns to match against * @return a filtered list of key-values */ private List<CKeyValue> filterConstraint(Result toFilter, CColumn columns) { // if there are no results, just return an empty list if (!toFilter.getKeyValues().iterator().hasNext()) return Collections.EMPTY_LIST; List<CKeyValue> rows = new ArrayList<CKeyValue>(); LexicographicByteArrayComparator comparator = LexicographicByteArrayComparator.INSTANCE; for (CKeyValue kv : toFilter.getKeyValues()) { // if we are accepting all CFs if (comparator.compare(CColumn.ALL_COLUMNS.getColumnFamily(), columns.getColumnFamily()) == 0) rows.add(kv); // since we aren't accepting all CFs, check the stored against the sent if (comparator.compare(columns.getColumnFamily(), kv.getFamily()) == 0) { // if we are accepting all CQs if (comparator.compare( CColumn.ALL_COLUMNS.getColumnQualifier(), columns.getColumnQualifier()) == 0) rows.add(kv); // since we aren't accepting all CQs, check the stored against the sent if (comparator.compare(columns.getColumnQualifier(), kv.getQualifier()) == 0) rows.add(kv); } } return rows; }