hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [01/28] hbase git commit: HBASE-18094 Display the return value of the command append [Forced Update!]
Date Tue, 23 May 2017 18:37:38 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-14614 f24362c15 -> 4143c0176 (forced update)


HBASE-18094 Display the return value of the command append

Signed-off-by: tedyu <yuzhihong@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/HBASE-14614
Commit: ebe92c8fb3153367531aac3cf2b60d65f782083d
Parents: 9e7b0c1
Author: Guangxu Cheng <guangxucheng@gmail.com>
Authored: Tue May 23 17:59:05 2017 +0800
Committer: tedyu <yuzhihong@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
     #-------------------------------------------------------------------------------
 


Mime
View raw message