HBASE-18094 Display the return value of the command append

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Guangxu Cheng 2017-05-23 19:34:58 +08:00 committed by tedyu
parent abf03da41d
commit 8c313d5be4
3 changed files with 11 additions and 3 deletions

View File

@ -244,7 +244,12 @@ EOF
set_op_ttl(append, ttl) if ttl
end
append.add(family, qualifier, value.to_s.to_java_bytes)
@table.append(append)
result = @table.append(append)
return nil if result.isEmpty
# Fetch cell value
cell = result.listCells[0]
org.apache.hadoop.hbase.util.Bytes::toStringBinary(cell.getValue)
end
#----------------------------------------------------------------------------------------------

View File

@ -40,8 +40,10 @@ EOF
end
def append(table, row, column, value, args={})
format_simple_command do
table._append_internal(row, column, value, args)
format_simple_command do
if current_value = table._append_internal(row, column, value, args)
puts "CURRENT VALUE = #{current_value}"
end
end
end
end

View File

@ -183,6 +183,7 @@ module Hbase
define_test "append should work with value" do
@test_table.append("123", 'x:cnt2', '123')
assert_equal("123123", @test_table._append_internal("123", 'x:cnt2', '123'))
end
#-------------------------------------------------------------------------------