hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject git commit: HBASE-11088 Support Visibility Expression Deletes in Shell (Ram)
Date Wed, 09 Jul 2014 06:21:11 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 bf3984058 -> 0acab9cab


HBASE-11088 Support Visibility Expression Deletes in Shell (Ram)


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

Branch: refs/heads/branch-1
Commit: 0acab9caba70d39a3aedaccfb63d95c697462ce6
Parents: bf39840
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Wed Jul 9 11:50:24 2014 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Wed Jul 9 11:50:24 2014 +0530

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/table.rb        | 23 +++++++++++++++++---
 .../src/main/ruby/shell/commands/delete.rb      | 12 ++++++----
 .../src/main/ruby/shell/commands/deleteall.rb   | 10 +++++----
 hbase-shell/src/main/ruby/shell/commands/put.rb |  2 +-
 4 files changed, 35 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0acab9ca/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 5f71070..14fe1e4 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -160,15 +160,32 @@ EOF
 
     #----------------------------------------------------------------------------------------------
     # Delete a cell
-    def _delete_internal(row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
-      _deleteall_internal(row, column, timestamp)
+    def _delete_internal(row, column, 
+    			timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
+      _deleteall_internal(row, column, timestamp, args)
     end
 
     #----------------------------------------------------------------------------------------------
     # Delete a row
-    def _deleteall_internal(row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
+    def _deleteall_internal(row, column = nil, 
+    		timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
       raise ArgumentError, "Row Not Found" if _get_internal(row).nil?
+      temptimestamp = timestamp
+      if temptimestamp.kind_of?(Hash)
+      	  timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP
+      end
       d = org.apache.hadoop.hbase.client.Delete.new(row.to_s.to_java_bytes, timestamp)
+      if temptimestamp.kind_of?(Hash)
+      	temptimestamp.each do |k, v|
+      	  if v.kind_of?(String)
+      	  	set_cell_visibility(d, v) if v
+      	  end
+      	 end 
+      end
+      if args.any?
+         visibility = args[VISIBILITY]
+         set_cell_visibility(d, visibility) if visibility
+      end
       if column
         family, qualifier = parse_column_name(column)
         d.deleteColumns(family, qualifier, timestamp)

http://git-wip-us.apache.org/repos/asf/hbase/blob/0acab9ca/hbase-shell/src/main/ruby/shell/commands/delete.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/delete.rb b/hbase-shell/src/main/ruby/shell/commands/delete.rb
index a0c50e3..dcb8341 100644
--- a/hbase-shell/src/main/ruby/shell/commands/delete.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/delete.rb
@@ -30,21 +30,25 @@ marked with the time 'ts1', do:
 
   hbase> delete 'ns1:t1', 'r1', 'c1', ts1
   hbase> delete 't1', 'r1', 'c1', ts1
+  hbase> delete 't1', 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
 
 The same command can also be run on a table reference. Suppose you had a reference
 t to table 't1', the corresponding command would be:
 
   hbase> t.delete 'r1', 'c1',  ts1
+  hbase> t.delete 'r1', 'c1',  ts1, {VISIBILITY=>'PRIVATE|SECRET'}
 EOF
       end
 
-      def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
-        delete(table(table), row, column, timestamp)
+      def command(table, row, column, 
+      				timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
+        delete(table(table), row, column, timestamp, args)
       end
 
-      def delete(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
+      def delete(table, row, column, 
+      				timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args = {})
         format_simple_command do
-          table._delete_internal(row, column, timestamp)
+          table._delete_internal(row, column, timestamp, args)
         end
       end
     end

http://git-wip-us.apache.org/repos/asf/hbase/blob/0acab9ca/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
index 197dbd4..e6118c9 100644
--- a/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/deleteall.rb
@@ -29,6 +29,7 @@ a column and timestamp. Examples:
   hbase> deleteall 't1', 'r1'
   hbase> deleteall 't1', 'r1', 'c1'
   hbase> deleteall 't1', 'r1', 'c1', ts1
+  hbase> deleteall 't1', 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
 
 The same commands also can be run on a table reference. Suppose you had a reference
 t to table 't1', the corresponding command would be:
@@ -36,18 +37,19 @@ t to table 't1', the corresponding command would be:
   hbase> t.deleteall 'r1'
   hbase> t.deleteall 'r1', 'c1'
   hbase> t.deleteall 'r1', 'c1', ts1
+  hbase> t.deleteall 'r1', 'c1', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
 EOF
       end
 
       def command(table, row, column = nil,
-                  timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
-        deleteall(table(table), row, column, timestamp)
+                  timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args
= {})
+        deleteall(table(table), row, column, timestamp, args)
       end
 
       def deleteall(table, row, column = nil,
-                    timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
+                    timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP, args
= {})
         format_simple_command do
-          table._deleteall_internal(row, column, timestamp)
+          table._deleteall_internal(row, column, timestamp, args)
         end
       end
     end

http://git-wip-us.apache.org/repos/asf/hbase/blob/0acab9ca/hbase-shell/src/main/ruby/shell/commands/put.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/put.rb b/hbase-shell/src/main/ruby/shell/commands/put.rb
index 4879200..2b47a4d 100644
--- a/hbase-shell/src/main/ruby/shell/commands/put.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/put.rb
@@ -31,7 +31,7 @@ at row 'r1' under column 'c1' marked with the time 'ts1', do:
   hbase> put 't1', 'r1', 'c1', 'value', ts1
   hbase> put 't1', 'r1', 'c1', 'value', {ATTRIBUTES=>{'mykey'=>'myvalue'}}
   hbase> put 't1', 'r1', 'c1', 'value', ts1, {ATTRIBUTES=>{'mykey'=>'myvalue'}}
-  hbase> put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=>'PRIVATE|SECRET'}}
+  hbase> put 't1', 'r1', 'c1', 'value', ts1, {VISIBILITY=>'PRIVATE|SECRET'}
 
 The same commands also can be run on a table reference. Suppose you had a reference
 t to table 't1', the corresponding command would be:


Mime
View raw message