public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) { List<Pair<byte[], byte[]>> fuzzyKeyDataCopy = new ArrayList<>(fuzzyKeysData.size()); for (Pair<byte[], byte[]> aFuzzyKeysData : fuzzyKeysData) { if (aFuzzyKeysData.getFirst().length != aFuzzyKeysData.getSecond().length) { Pair<String, String> readable = new Pair<>(Bytes.toStringBinary(aFuzzyKeysData.getFirst()), Bytes.toStringBinary(aFuzzyKeysData.getSecond())); throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable); } Pair<byte[], byte[]> p = new Pair<>(); // create a copy of pair bytes so that they are not modified by the filter. p.setFirst(Arrays.copyOf(aFuzzyKeysData.getFirst(), aFuzzyKeysData.getFirst().length)); p.setSecond(Arrays.copyOf(aFuzzyKeysData.getSecond(), aFuzzyKeysData.getSecond().length)); // update mask ( 0 -> -1 (0xff), 1 -> 2) p.setSecond(preprocessMask(p.getSecond())); preprocessSearchKey(p); fuzzyKeyDataCopy.add(p); } this.fuzzyKeysData = fuzzyKeyDataCopy; this.tracker = new RowTracker(); }
boolean updateTracker(Cell currentCell) { if (!initialized) { for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) { updateWith(currentCell, fuzzyData); } initialized = true; } else { while (!nextRows.isEmpty() && !lessThan(currentCell, nextRows.peek().getFirst())) { Pair<byte[], Pair<byte[], byte[]>> head = nextRows.poll(); Pair<byte[], byte[]> fuzzyData = head.getSecond(); updateWith(currentCell, fuzzyData); } } return !nextRows.isEmpty(); }
public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) { Pair<byte[], byte[]> p; for (int i = 0; i < fuzzyKeysData.size(); i++) { p = fuzzyKeysData.get(i); if (p.getFirst().length != p.getSecond().length) { Pair<String, String> readable = new Pair<String, String>(Bytes.toStringBinary(p.getFirst()), Bytes.toStringBinary(p .getSecond())); throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable); } // update mask ( 0 -> -1 (0xff), 1 -> 0) p.setSecond(preprocessMask(p.getSecond())); preprocessSearchKey(p); } this.fuzzyKeysData = fuzzyKeysData; this.tracker = new RowTracker(); }
public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) { List<Pair<byte[], byte[]>> fuzzyKeyDataCopy = new ArrayList<>(fuzzyKeysData.size()); for (Pair<byte[], byte[]> aFuzzyKeysData : fuzzyKeysData) { if (aFuzzyKeysData.getFirst().length != aFuzzyKeysData.getSecond().length) { Pair<String, String> readable = new Pair<>(Bytes.toStringBinary(aFuzzyKeysData.getFirst()), Bytes.toStringBinary(aFuzzyKeysData.getSecond())); throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable); } Pair<byte[], byte[]> p = new Pair<>(); // create a copy of pair bytes so that they are not modified by the filter. p.setFirst(Arrays.copyOf(aFuzzyKeysData.getFirst(), aFuzzyKeysData.getFirst().length)); p.setSecond(Arrays.copyOf(aFuzzyKeysData.getSecond(), aFuzzyKeysData.getSecond().length)); // update mask ( 0 -> -1 (0xff), 1 -> 2) p.setSecond(preprocessMask(p.getSecond())); preprocessSearchKey(p); fuzzyKeyDataCopy.add(p); } this.fuzzyKeysData = fuzzyKeyDataCopy; this.tracker = new RowTracker(); }
boolean updateTracker(Cell currentCell) { if (!initialized) { for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) { updateWith(currentCell, fuzzyData); } initialized = true; } else { while (!nextRows.isEmpty() && !lessThan(currentCell, nextRows.peek().getFirst())) { Pair<byte[], Pair<byte[], byte[]>> head = nextRows.poll(); Pair<byte[], byte[]> fuzzyData = head.getSecond(); updateWith(currentCell, fuzzyData); } } return !nextRows.isEmpty(); }
boolean updateTracker(Cell currentCell) { if (!initialized) { for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) { updateWith(currentCell, fuzzyData); } initialized = true; } else { while (!nextRows.isEmpty() && !lessThan(currentCell, nextRows.peek().getFirst())) { Pair<byte[], Pair<byte[], byte[]>> head = nextRows.poll(); Pair<byte[], byte[]> fuzzyData = head.getSecond(); updateWith(currentCell, fuzzyData); } } return !nextRows.isEmpty(); }
@Override public Cell getNextCellHint(Cell currentCell) { boolean result = tracker.updateTracker(currentCell); if (result == false) { done = true; return null; } byte[] nextRowKey = tracker.nextRow(); return KeyValueUtil.createFirstOnRow(nextRowKey); }
@Override public Cell getNextCellHint(Cell currentCell) { boolean result = tracker.updateTracker(currentCell); if (result == false) { done = true; return null; } byte[] nextRowKey = tracker.nextRow(); return PrivateCellUtil.createFirstOnRow(nextRowKey, 0, (short) nextRowKey.length); }
public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) { List<Pair<byte[], byte[]>> fuzzyKeyDataCopy = new ArrayList<>(fuzzyKeysData.size()); for (Pair<byte[], byte[]> aFuzzyKeysData : fuzzyKeysData) { if (aFuzzyKeysData.getFirst().length != aFuzzyKeysData.getSecond().length) { Pair<String, String> readable = new Pair<>(Bytes.toStringBinary(aFuzzyKeysData.getFirst()), Bytes.toStringBinary(aFuzzyKeysData.getSecond())); throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable); } Pair<byte[], byte[]> p = new Pair<>(); // create a copy of pair bytes so that they are not modified by the filter. p.setFirst(Arrays.copyOf(aFuzzyKeysData.getFirst(), aFuzzyKeysData.getFirst().length)); p.setSecond(Arrays.copyOf(aFuzzyKeysData.getSecond(), aFuzzyKeysData.getSecond().length)); // update mask ( 0 -> -1 (0xff), 1 -> 2) p.setSecond(preprocessMask(p.getSecond())); preprocessSearchKey(p); fuzzyKeyDataCopy.add(p); } this.fuzzyKeysData = fuzzyKeyDataCopy; this.tracker = new RowTracker(); }
boolean updateTracker(Cell currentCell) { if (!initialized) { for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) { updateWith(currentCell, fuzzyData); } initialized = true; } else { while (!nextRows.isEmpty() && !lessThan(currentCell, nextRows.peek().getFirst())) { Pair<byte[], Pair<byte[], byte[]>> head = nextRows.poll(); Pair<byte[], byte[]> fuzzyData = head.getSecond(); updateWith(currentCell, fuzzyData); } } return !nextRows.isEmpty(); }
@Override public Cell getNextCellHint(Cell currentCell) { boolean result = tracker.updateTracker(currentCell); if (result == false) { done = true; return null; } byte[] nextRowKey = tracker.nextRow(); return PrivateCellUtil.createFirstOnRow(nextRowKey, 0, (short) nextRowKey.length); }
@Override public Cell getNextCellHint(Cell currentCell) { boolean result = tracker.updateTracker(currentCell); if (result == false) { done = true; return null; } byte[] nextRowKey = tracker.nextRow(); return PrivateCellUtil.createFirstOnRow(nextRowKey, 0, (short) nextRowKey.length); }