HBASE-2035 Binary values are formatted wrong in shell

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@896738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-01-07 02:25:12 +00:00
parent 5e65d6ee2f
commit 73aa65deb3
4 changed files with 7 additions and 7 deletions

View File

@ -286,6 +286,7 @@ Release 0.21.0 - Unreleased
(Erik Rozendaal and Dave Latham via Stack) (Erik Rozendaal and Dave Latham via Stack)
HBASE-2090 findbugs issues (Kay Kay via Stack) HBASE-2090 findbugs issues (Kay Kay via Stack)
HBASE-2089 HBaseConfiguration() ctor. deprecated (Kay Kay via Stack) HBASE-2089 HBaseConfiguration() ctor. deprecated (Kay Kay via Stack)
HBASE-2035 Binary values are formatted wrong in shell
NEW FEATURES NEW FEATURES
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write

View File

@ -96,7 +96,7 @@ module Formatter
return return
end end
# Remove double-quotes added by 'dump'. # Remove double-quotes added by 'dump'.
return str.dump[1..-2] return str
end end
def output(width, str) def output(width, str)

View File

@ -425,13 +425,13 @@ module HBase
i = s.iterator() i = s.iterator()
while i.hasNext() while i.hasNext()
r = i.next() r = i.next()
row = String.from_java_bytes r.getRow() row = Bytes::toStringBinary(r.getRow())
if limit != -1 and count >= limit if limit != -1 and count >= limit
break break
end end
for kv in r.list for kv in r.list
family = String.from_java_bytes kv.getFamily() family = String.from_java_bytes kv.getFamily()
qualifier = String.from_java_bytes kv.getQualifier() qualifier = Bytes::toStringBinary(kv.getQualifier())
column = family + ':' + qualifier column = family + ':' + qualifier
cell = toString(column, kv, maxlength) cell = toString(column, kv, maxlength)
@formatter.row([row, "column=%s, %s" % [column, cell]]) @formatter.row([row, "column=%s, %s" % [column, cell]])
@ -494,7 +494,7 @@ module HBase
Bytes.toLong(kv.getValue())] Bytes.toLong(kv.getValue())]
end end
end end
val = "timestamp=" + kv.getTimestamp().to_s + ", value=" + Bytes.toStringBinary(kv.getValue()) val = "timestamp=" + kv.getTimestamp().to_s + ", value=" + Bytes::toStringBinary(kv.getValue())
maxlength != -1 ? val[0, maxlength] : val maxlength != -1 ? val[0, maxlength] : val
end end
@ -555,7 +555,7 @@ module HBase
if !result.isEmpty() if !result.isEmpty()
for kv in result.list() for kv in result.list()
family = String.from_java_bytes kv.getFamily() family = String.from_java_bytes kv.getFamily()
qualifier = String.from_java_bytes kv.getQualifier() qualifier = Bytes::toStringBinary(kv.getQualifier())
column = family + ':' + qualifier column = family + ':' + qualifier
@formatter.row([column, toString(column, kv, maxlength)]) @formatter.row([column, toString(column, kv, maxlength)])
end end

View File

@ -298,8 +298,7 @@ NAME, VERSIONS, COMPRESSION, etc. Constants do not need to be quoted. Type
'Object.constants' to see a (messy) list of all constants in the environment. 'Object.constants' to see a (messy) list of all constants in the environment.
In case you are using binary keys or values and need to enter them into the In case you are using binary keys or values and need to enter them into the
shell then use double-quotes to make use of hexadecimal or octal notations, shell then use double-quotes to make use of hexadecimal for example:
for example:
hbase> get 't1', "key\\x03\\x3f\\xcd" hbase> get 't1', "key\\x03\\x3f\\xcd"
hbase> get 't1', "key\\003\\023\\011" hbase> get 't1', "key\\003\\023\\011"