Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30AD51845A for ; Sat, 26 Dec 2015 17:07:39 +0000 (UTC) Received: (qmail 53327 invoked by uid 500); 26 Dec 2015 17:07:35 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 53244 invoked by uid 500); 26 Dec 2015 17:07:35 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 52195 invoked by uid 99); 26 Dec 2015 17:07:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Dec 2015 17:07:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8592AE098D; Sat, 26 Dec 2015 17:07:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: syuanjiang@apache.org To: commits@hbase.apache.org Date: Sat, 26 Dec 2015 17:08:08 -0000 Message-Id: In-Reply-To: <4b2dc674701341778244459ca56edc98@git.apache.org> References: <4b2dc674701341778244459ca56edc98@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [35/43] hbase git commit: HBASE-15032 hbase shell scan filter string assumes UTF-8 encoding (huaxiang sun) 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/e15c48ed Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e15c48ed Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e15c48ed Branch: refs/heads/hbase-12439 Commit: e15c48ed2cf025dd3b0790c55cdc4239cc0fc161 Parents: 0bdd6e4 Author: tedyu Authored: Thu Dec 24 07:00:22 2015 -0800 Committer: tedyu Committed: Thu Dec 24 07:00:22 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/e15c48ed/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 2535a68..b5769ca 100644 --- a/hbase-shell/src/main/ruby/hbase/table.rb +++ b/hbase-shell/src/main/ruby/hbase/table.rb @@ -359,7 +359,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 @@ -458,7 +459,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/e15c48ed/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 70ed04b..d4547b7 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 "scan hbase meta table" do res = table("hbase:meta")._scan_internal assert_not_nil(res)