原本這個內容是不單獨講的,可是由於上一個頁面太大,致使Live Writer死機了,不能繼續編輯了,因此就放棄了ide
這裏要講的是自定義filter,從FilterBase繼承this
public class CustomFilter extends FilterBase { private byte[] value = null; private boolean filterRow = true; public CustomFilter() { super(); } public CustomFilter(byte[] value) { this.value = value; } @Override public void reset() { this.filterRow = true; } @Override public ReturnCode filterKeyValue(KeyValue kv) { if (Bytes.compareTo(value, kv.getValue()) == 0) { filterRow = false; } return ReturnCode.INCLUDE; } @Override public boolean filterRow() { return filterRow; } @Override public void write(DataOutput dataOutput) throws IOException { Bytes.writeByteArray(dataOutput, this.value); } @Override public void readFields(DataInput dataInput) throws IOException { this.value = Bytes.readByteArray(dataInput); } }
而後打成jar包,要在hbase-env.sh中指明路徑。spa
export HBASE_CLASSPATH="/hbase/target/hbase-customfilter.jar",而後就能夠在客戶端中使用它了。code