diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb index 946c72cc950..3185939afc4 100644 --- a/hbase-shell/src/main/ruby/hbase/table.rb +++ b/hbase-shell/src/main/ruby/hbase/table.rb @@ -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 #---------------------------------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/shell/commands/append.rb b/hbase-shell/src/main/ruby/shell/commands/append.rb index 93a43174365..c2fb9c19abb 100644 --- a/hbase-shell/src/main/ruby/shell/commands/append.rb +++ b/hbase-shell/src/main/ruby/shell/commands/append.rb @@ -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 diff --git a/hbase-shell/src/test/ruby/hbase/table_test.rb b/hbase-shell/src/test/ruby/hbase/table_test.rb index 53d0ca9f81a..90ed7fca82f 100644 --- a/hbase-shell/src/test/ruby/hbase/table_test.rb +++ b/hbase-shell/src/test/ruby/hbase/table_test.rb @@ -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 #-------------------------------------------------------------------------------