You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2017/05/23 15:59:08 UTC

hbase git commit: HBASE-18094 Display the return value of the command append

Repository: hbase
Updated Branches:
  refs/heads/master 9e7b0c1a4 -> ebe92c8fb


HBASE-18094 Display the return value of the command append

Signed-off-by: tedyu <yu...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ebe92c8f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ebe92c8f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ebe92c8f

Branch: refs/heads/master
Commit: ebe92c8fb3153367531aac3cf2b60d65f782083d
Parents: 9e7b0c1
Author: Guangxu Cheng <gu...@gmail.com>
Authored: Tue May 23 17:59:05 2017 +0800
Committer: tedyu <yu...@gmail.com>
Committed: Tue May 23 08:59:05 2017 -0700

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/table.rb           | 8 +++++++-
 hbase-shell/src/main/ruby/shell/commands/append.rb | 4 +++-
 hbase-shell/src/test/ruby/hbase/table_test.rb      | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ebe92c8f/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 946c72c..3185939 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
 
     #----------------------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/hbase/blob/ebe92c8f/hbase-shell/src/main/ruby/shell/commands/append.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/append.rb b/hbase-shell/src/main/ruby/shell/commands/append.rb
index 93a4317..c2fb9c1 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

http://git-wip-us.apache.org/repos/asf/hbase/blob/ebe92c8f/hbase-shell/src/test/ruby/hbase/table_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/table_test.rb b/hbase-shell/src/test/ruby/hbase/table_test.rb
index 53d0ca9..90ed7fc 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
     #-------------------------------------------------------------------------------