/** * Returns mapping of all that match the given keySet provided they pass the combinedFilter predicate * for default COLUMN * * @param keySet row key set * @param typeOfT the type of the result * @param limit limit number of result * @param combinedFilter filter for key * @return map of row key to result */ public <T> Map<MDSKey, T> listKV(Set<MDSKey> keySet, Type typeOfT, int limit, @Nullable Predicate<KeyValue<T>> combinedFilter) { // Sort fuzzy keys List<MDSKey> sortedKeys = Lists.newArrayList(keySet); Collections.sort(sortedKeys); // Scan using fuzzy filter byte[] startKey = sortedKeys.get(0).getKey(); byte[] stopKey = Bytes.stopKeyForPrefix(sortedKeys.get(sortedKeys.size() - 1).getKey()); List<ImmutablePair<byte [], byte []>> fuzzyKeys = new ArrayList<>(); for (MDSKey key : sortedKeys) { fuzzyKeys.add(getFuzzyKeyFor(key)); } Scan scan = new Scan(startKey, stopKey, new FuzzyRowFilter(fuzzyKeys)); return listCombinedFilterKV(scan, typeOfT, limit, combinedFilter); }
/** * Returns mapping of all that match the given keySet provided they pass the combinedFilter predicate * for default COLUMN * * @param keySet row key set * @param typeOfT the type of the result * @param limit limit number of result * @param combinedFilter filter for key * @return map of row key to result */ public <T> Map<MDSKey, T> listKV(Set<MDSKey> keySet, Type typeOfT, int limit, @Nullable Predicate<KeyValue<T>> combinedFilter) { // Sort fuzzy keys List<MDSKey> sortedKeys = Lists.newArrayList(keySet); Collections.sort(sortedKeys); // Scan using fuzzy filter byte[] startKey = sortedKeys.get(0).getKey(); byte[] stopKey = Bytes.stopKeyForPrefix(sortedKeys.get(sortedKeys.size() - 1).getKey()); List<ImmutablePair<byte [], byte []>> fuzzyKeys = new ArrayList<>(); for (MDSKey key : sortedKeys) { fuzzyKeys.add(getFuzzyKeyFor(key)); } Scan scan = new Scan(startKey, stopKey, new FuzzyRowFilter(fuzzyKeys)); return listCombinedFilterKV(scan, typeOfT, limit, combinedFilter); }