hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-15032 hbase shell scan filter string assumes UTF-8 encoding (huaxiang sun)
Date Thu, 24 Dec 2015 15:04:07 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 27988208a -> ae1fc1d5c


HBASE-15032 hbase shell scan filter string assumes UTF-8 encoding (huaxiang sun)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ae1fc1d5
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ae1fc1d5
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ae1fc1d5

Branch: refs/heads/branch-1.2
Commit: ae1fc1d5cdaab06ec921bf3032ee840a33330b66
Parents: 2798820
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Dec 24 07:03:57 2015 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Dec 24 07:03:57 2015 -0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/table.rb      |  6 ++++--
 hbase-shell/src/test/ruby/hbase/table_test.rb | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ae1fc1d5/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 0946eb2..74868c2 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -358,7 +358,8 @@ EOF
       unless filter.class == String
         get.setFilter(filter)
       else
-        get.setFilter(org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter))
+        get.setFilter(
+          org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter.to_java_bytes))
       end
 
       get.setConsistency(org.apache.hadoop.hbase.client.Consistency.valueOf(consistency))
if consistency
@@ -454,7 +455,8 @@ EOF
         unless filter.class == String
           scan.setFilter(filter)
         else
-          scan.setFilter(org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter))
+          scan.setFilter(
+            org.apache.hadoop.hbase.filter.ParseFilter.new.parseFilterString(filter.to_java_bytes))
         end
 
         scan.setScanMetricsEnabled(enablemetrics) if enablemetrics

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae1fc1d5/hbase-shell/src/test/ruby/hbase/table_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/table_test.rb b/hbase-shell/src/test/ruby/hbase/table_test.rb
index 184e0d4..d74c6d8 100644
--- a/hbase-shell/src/test/ruby/hbase/table_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/table_test.rb
@@ -598,6 +598,22 @@ module Hbase
       end
     end
 
+    define_test "scan should support FILTER with non-ASCII bytes" do
+      @test_table.put(4, "x:a", "\x82")
+      begin
+        res = @test_table._scan_internal FILTER => "SingleColumnValueFilter('x', 'a',
>=, 'binary:\x82', true, true)"
+        assert_not_equal(res, {}, "Result is empty")
+        assert_kind_of(Hash, res)
+        assert_not_nil(res['4'])
+        assert_not_nil(res['4']['x:a'])
+        assert_nil(res['1'])
+        assert_nil(res['2'])
+      ensure
+        # clean up newly added columns for this test only.
+        @test_table.delete(4, "x:a")
+      end
+    end
+
     define_test "mutation with TTL should expire" do
       @test_table.put('ttlTest', 'x:a', 'foo', { TTL => 1000 } )
       begin


Mime
View raw message