HBASE-11088 Support Visibility Expression Deletes in Shell (Ram)
This commit is contained in:
parent
bf39840582
commit
0acab9caba
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue