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

hbase git commit: HBASE-19178 table.rb use undefined method 'getType' for Cell interface

Repository: hbase
Updated Branches:
  refs/heads/master 35a2b8e53 -> 349dd5e21


HBASE-19178 table.rb use undefined method 'getType' for Cell interface


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

Branch: refs/heads/master
Commit: 349dd5e214d811c7fd6a40b8e3949b64e7389763
Parents: 35a2b8e
Author: Guanghao Zhang <zg...@apache.org>
Authored: Sat Nov 4 11:02:19 2017 +0800
Committer: Guanghao Zhang <zg...@apache.org>
Committed: Sun Nov 5 08:01:30 2017 +0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/table.rb      |  2 +-
 hbase-shell/src/test/ruby/hbase/table_test.rb | 39 ++++++++++++++++------
 2 files changed, 30 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/349dd5e2/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 320ec7c..07c74d8 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -749,7 +749,7 @@ EOF
       end
 
       if org.apache.hadoop.hbase.CellUtil.isDelete(kv)
-        val = "timestamp=#{kv.getTimestamp}, type=#{org.apache.hadoop.hbase.KeyValue::Type.codeToType(kv.getType)}"
+        val = "timestamp=#{kv.getTimestamp}, type=#{org.apache.hadoop.hbase.KeyValue::Type.codeToType(kv.getTypeByte)}"
       else
         val = "timestamp=#{kv.getTimestamp}, value=#{convert(column, kv, converter_class, converter)}"
       end

http://git-wip-us.apache.org/repos/asf/hbase/blob/349dd5e2/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 81d0a9a..e7e1b23 100644
--- a/hbase-shell/src/test/ruby/hbase/table_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/table_test.rb
@@ -557,21 +557,40 @@ module Hbase
       @test_table.put(2, "x:raw1", 11)
 
       args = {}
-      numRows = 0
-      count = @test_table._scan_internal(args) do |row, cells| # Normal Scan
-        numRows += 1
+      num_rows = 0
+      @test_table._scan_internal(args) do # Normal Scan
+        num_rows += 1
       end
-      assert_equal(numRows, 2, "Num rows scanned without RAW/VERSIONS are not 2") 
+      assert_equal(num_rows, 2,
+                   'Num rows scanned without RAW/VERSIONS are not 2')
 
-      args = {VERSIONS=>10,RAW=>true} # Since 4 versions of row with rowkey 2 is been added, we can use any number >= 4 for VERSIONS to scan all 4 versions.
-      numRows = 0
-      count = @test_table._scan_internal(args) do |row, cells| # Raw Scan
-        numRows += 1
+      args = { VERSIONS => 10, RAW => true } # Since 4 versions of row with rowkey 2 is been added, we can use any number >= 4 for VERSIONS to scan all 4 versions.
+      num_rows = 0
+      @test_table._scan_internal(args) do # Raw Scan
+        num_rows += 1
       end
-      assert_equal(numRows, 5, "Num rows scanned without RAW/VERSIONS are not 5") # 5 since , 1 from row key '1' and other 4 from row key '4'
-    end
+      # 5 since , 1 from row key '1' and other 4 from row key '4'
+      assert_equal(num_rows, 5,
+                   'Num rows scanned without RAW/VERSIONS are not 5')
 
+      @test_table.delete(1, 'x:a')
+      args = {}
+      num_rows = 0
+      @test_table._scan_internal(args) do # Normal Scan
+        num_rows += 1
+      end
+      assert_equal(num_rows, 1,
+                   'Num rows scanned without RAW/VERSIONS are not 1')
 
+      args = { VERSIONS => 10, RAW => true }
+      num_rows = 0
+      @test_table._scan_internal(args) do # Raw Scan
+        num_rows += 1
+      end
+      # 6 since , 2 from row key '1' and other 4 from row key '4'
+      assert_equal(num_rows, 6,
+                   'Num rows scanned without RAW/VERSIONS are not 5')
+    end
 
     define_test "scan should fail on invalid COLUMNS parameter types" do
       assert_raise(ArgumentError) do