hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1212178 - in /hbase/trunk/src/main/ruby: hbase.rb hbase/table.rb shell/commands/scan.rb
Date Thu, 08 Dec 2011 23:01:09 GMT
Author: larsh
Date: Thu Dec  8 23:01:08 2011
New Revision: 1212178

URL: http://svn.apache.org/viewvc?rev=1212178&view=rev
Log:
HBASE-4981 add raw scan support to shell (Lars H)

Modified:
    hbase/trunk/src/main/ruby/hbase.rb
    hbase/trunk/src/main/ruby/hbase/table.rb
    hbase/trunk/src/main/ruby/shell/commands/scan.rb

Modified: hbase/trunk/src/main/ruby/hbase.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/hbase.rb?rev=1212178&r1=1212177&r2=1212178&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/hbase.rb (original)
+++ hbase/trunk/src/main/ruby/hbase.rb Thu Dec  8 23:01:08 2011
@@ -43,6 +43,7 @@ module HBaseConstants
   STOPROW = "STOPROW"
   STARTROW = "STARTROW"
   ENDROW = STOPROW
+  RAW = "RAW"
   LIMIT = "LIMIT"
   METHOD = "METHOD"
   MAXLENGTH = "MAXLENGTH"

Modified: hbase/trunk/src/main/ruby/hbase/table.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/hbase/table.rb?rev=1212178&r1=1212177&r2=1212178&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/hbase/table.rb (original)
+++ hbase/trunk/src/main/ruby/hbase/table.rb Thu Dec  8 23:01:08 2011
@@ -218,10 +218,11 @@ module Hbase
         startrow = args["STARTROW"] || ''
         stoprow = args["STOPROW"]
         timestamp = args["TIMESTAMP"]
-        columns = args["COLUMNS"] || args["COLUMN"] || get_all_columns
+        columns = args["COLUMNS"] || args["COLUMN"] || []
         cache = args["CACHE_BLOCKS"] || true
         versions = args["VERSIONS"] || 1
         timerange = args[TIMERANGE]
+        raw = args["RAW"] || false
 
         # Normalize column names
         columns = [columns] if columns.class == String
@@ -254,6 +255,7 @@ module Hbase
         scan.setCacheBlocks(cache)
         scan.setMaxVersions(versions) if versions > 1
         scan.setTimeRange(timerange[0], timerange[1]) if timerange
+        scan.setRaw(raw)
       else
         scan = org.apache.hadoop.hbase.client.Scan.new
       end
@@ -335,7 +337,11 @@ module Hbase
         end
       end
 
-      val = "timestamp=#{kv.getTimestamp}, value=#{org.apache.hadoop.hbase.util.Bytes::toStringBinary(kv.getValue)}"
+      if kv.isDelete
+        val = "timestamp=#{kv.getTimestamp}, type=#{org.apache.hadoop.hbase.KeyValue::Type::codeToType(kv.getType)}"
+      else
+        val = "timestamp=#{kv.getTimestamp}, value=#{org.apache.hadoop.hbase.util.Bytes::toStringBinary(kv.getValue)}"
+      end
       (maxlength != -1) ? val[0, maxlength] : val
     end
 

Modified: hbase/trunk/src/main/ruby/shell/commands/scan.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/scan.rb?rev=1212178&r1=1212177&r2=1212178&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/scan.rb (original)
+++ hbase/trunk/src/main/ruby/shell/commands/scan.rb Thu Dec  8 23:01:08 2011
@@ -51,6 +51,13 @@ switches block caching for the scanner o
 default it is enabled.  Examples:
 
   hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
+
+Also for experts, there is an advanced option -- RAW -- which instructs the
+scanner to return all cells (including delete markers and uncollected deleted
+cells). This option cannot be combined with requesting specific COLUMNS.
+Disabled by default.  Example:
+
+  hbase> scan 't1', {RAW => true, VERSIONS => 10}
 EOF
       end
 



Mime
View raw message