MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / FuzzyRowFilter

Class FuzzyRowFilter

src/FuzzyRowFilter.java:69–184  ·  view source on GitHub ↗

FuzzyRowFilter is a server-side fast-forward filter that allows skipping whole range of rows when scanning. The feature is available in HBase 0.94.5 and above. It takes two byte array to match a rowkey, one to hold the fixed value and one to hold a mask indicating which bytes of the rowkey must

Source from the content-addressed store, hash-verified

67 * @since 1.7
68 */
69public final class FuzzyRowFilter extends ScanFilter {
70
71 private static final byte[] NAME =
72 Bytes.UTF8("org.apache.hadoop.hbase.filter.FuzzyRowFilter");
73
74 private final Collection<FuzzyFilterPair> filter_pairs;
75
76 /**
77 * Holds a pair of (row_key,fuzzy_mask) to use with {@link FuzzyRowFilter}
78 */
79 public static class FuzzyFilterPair {
80 private final byte[] row_key;
81 private final byte[] fuzzy_mask;
82
83 /**
84 * Default Ctor
85 * @param row_key The row key to use for matching
86 * @param fuzzy_mask The row key mask to determine which of the bytes in
87 * {@code row_key} should be matched.
88 * @throws IllegalArgumentException if the keys are not the same length
89 */
90 public FuzzyFilterPair(final byte[] row_key, final byte[] fuzzy_mask) {
91 if ( row_key.length != fuzzy_mask.length ) {
92 throw new IllegalArgumentException("Row key and fuzzy mask length " +
93 "must match");
94 }
95 this.row_key = row_key;
96 this.fuzzy_mask = fuzzy_mask;
97 }
98
99 /** @return the row key base filter */
100 public byte[] getRowKey() {
101 return row_key;
102 }
103
104 /** @return the row key mask */
105 public byte[] getFuzzyMask() {
106 return fuzzy_mask;
107 }
108
109 @Override
110 public String toString() {
111 final StringBuilder buf = new StringBuilder();
112 buf.append("FuzzyFilterPair{row_key=")
113 .append(Bytes.pretty(row_key))
114 .append(", mask=")
115 .append(Bytes.pretty(fuzzy_mask))
116 .append("}");
117 return buf.toString();
118 }
119 }
120
121 /**
122 * Default ctor that applies a single fuzzy filter against all row keys
123 * @param filter_pair A single filter to apply to all row keys
124 */
125 public FuzzyRowFilter(final FuzzyFilterPair filter_pair) {
126 this.filter_pairs = java.util.Collections.singleton(filter_pair);

Callers

nothing calls this directly

Calls 1

UTF8Method · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…