hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: HBASE-15032 hbase shell scan filter string assumes UTF-8 encoding (huaxiang sun)
Date Tue, 05 Jan 2016 01:11:33 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 ec1285cfb -> b32568a8a


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/b32568a8
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b32568a8
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b32568a8

Branch: refs/heads/0.98
Commit: b32568a8aecab63d58abcb63a341ff7f8db2ff6b
Parents: ec1285c
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Dec 24 07:02:04 2015 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Jan 4 17:02:26 2016 -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/b32568a8/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 cae66ef..4ce6f19 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -357,7 +357,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
 
       # Call hbase for the results
@@ -442,7 +443,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.setTimeStamp(timestamp) if timestamp

http://git-wip-us.apache.org/repos/asf/hbase/blob/b32568a8/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 86780a1..de27314 100644
--- a/hbase-shell/src/test/ruby/hbase/table_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/table_test.rb
@@ -560,6 +560,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