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 17:59:05 +08:00 committed by tedyu
parent 9e7b0c1a4f
commit ebe92c8fb3
3 changed files with 11 additions and 2 deletions

View File

@ -286,7 +286,13 @@ 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.getValueArray,
cell.getValueOffset, cell.getValueLength)
end
#----------------------------------------------------------------------------------------------

View File

@ -42,7 +42,9 @@ EOF
end
def append(table, row, column, value, args={})
table._append_internal(row, column, value, args)
if current_value = table._append_internal(row, column, value, args)
puts "CURRENT VALUE = #{current_value}"
end
end
end
end

View File

@ -195,6 +195,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
#-------------------------------------------------------------------------------