Repository: hbase Updated Branches: refs/heads/master a8471bd98 -> a34f129af
HBASE-20019 Document the ColumnValueFilter Signed-off-by: Chia-Ping Tsai <chia7...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a34f129a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a34f129a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a34f129a Branch: refs/heads/master Commit: a34f129affff9b5e1098f1c9e86b1b8e7202bb97 Parents: a8471bd Author: Reid Chan <reidddc...@outlook.com> Authored: Mon Feb 26 11:31:08 2018 +0800 Committer: Chia-Ping Tsai <chia7...@gmail.com> Committed: Mon Feb 26 14:59:42 2018 +0800 ---------------------------------------------------------------------- src/main/asciidoc/_chapters/architecture.adoc | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/a34f129a/src/main/asciidoc/_chapters/architecture.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/architecture.adoc b/src/main/asciidoc/_chapters/architecture.adoc index 9091d5e..6fb5891 100644 --- a/src/main/asciidoc/_chapters/architecture.adoc +++ b/src/main/asciidoc/_chapters/architecture.adoc @@ -321,6 +321,41 @@ SingleColumnValueFilter filter = new SingleColumnValueFilter( scan.setFilter(filter); ---- +[[client.filter.cv.cvf]] +==== ColumnValueFilter + +Introduced in HBase-2.0.0 version as a complementation of SingleColumnValueFilter, ColumnValueFilter +gets matched cell only, while SingleColumnValueFilter gets the entire row +(has other columns and values) to which the matched cell belongs. Parameters of constructor of +ColumnValueFilter are the same as SingleColumnValueFilter. +[source,java] +---- +ColumnValueFilter filter = new ColumnValueFilter( + cf, + column, + CompareOperaor.EQUAL, + Bytes.toBytes("my value") + ); +scan.setFilter(filter); +---- + +Note. For simple query like "equals to a family:qualifier:value", we highly recommend to use the +following way instead of using SingleColumnValueFilter or ColumnValueFilter: +[source,java] +---- +Scan scan = new Scan(); +scan.addColumn(Bytes.toBytes("family"), Bytes.toBytes("qualifier")); +ValueFilter vf = new ValueFilter(CompareOperator.EQUAL, + new BinaryComparator(Bytes.toBytes("value"))); +scan.setFilter(vf); +... +---- +This scan will restrict to the specified column 'family:qualifier', avoiding scan unrelated +families and columns, which has better performance, and `ValueFilter` is the condition used to do +the value filtering. + +But if query is much more complicated beyond this book, then please make your good choice case by case. + [[client.filter.cvp]] === Column Value Comparators