HBASE-15032 hbase shell scan filter string assumes UTF-8 encoding (huaxiang sun)
This commit is contained in:
parent
0bdd6e487f
commit
e15c48ed2c
|
@ -359,7 +359,8 @@ EOF
|
||||||
unless filter.class == String
|
unless filter.class == String
|
||||||
get.setFilter(filter)
|
get.setFilter(filter)
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
get.setConsistency(org.apache.hadoop.hbase.client.Consistency.valueOf(consistency)) if consistency
|
get.setConsistency(org.apache.hadoop.hbase.client.Consistency.valueOf(consistency)) if consistency
|
||||||
|
@ -458,7 +459,8 @@ EOF
|
||||||
unless filter.class == String
|
unless filter.class == String
|
||||||
scan.setFilter(filter)
|
scan.setFilter(filter)
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
scan.setScanMetricsEnabled(enablemetrics) if enablemetrics
|
scan.setScanMetricsEnabled(enablemetrics) if enablemetrics
|
||||||
|
|
|
@ -598,6 +598,22 @@ module Hbase
|
||||||
end
|
end
|
||||||
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
|
define_test "scan hbase meta table" do
|
||||||
res = table("hbase:meta")._scan_internal
|
res = table("hbase:meta")._scan_internal
|
||||||
assert_not_nil(res)
|
assert_not_nil(res)
|
||||||
|
|
Loading…
Reference in New Issue