From 7a5e6b8c0a7449fb6c6c1ca37b70753822243b83 Mon Sep 17 00:00:00 2001 From: Lars George Date: Sat, 28 Mar 2015 10:46:23 +0100 Subject: [PATCH] HBASE-10728 get_counter value is never used. --- hbase-shell/src/main/ruby/shell/commands/get_counter.rb | 10 +++++----- hbase-shell/src/main/ruby/shell/commands/incr.rb | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hbase-shell/src/main/ruby/shell/commands/get_counter.rb b/hbase-shell/src/main/ruby/shell/commands/get_counter.rb index 00cf64d..6708c6a 100644 --- a/hbase-shell/src/main/ruby/shell/commands/get_counter.rb +++ b/hbase-shell/src/main/ruby/shell/commands/get_counter.rb @@ -23,8 +23,8 @@ module Shell def help return <<-EOF Return a counter cell value at specified table/row/column coordinates. -A cell cell should be managed with atomic increment function oh HBase -and the data should be binary encoded. Example: +A counter cell should be managed with atomic increment functions on HBase +and the data should be binary encoded (as long value). Example: hbase> get_counter 'ns1:t1', 'r1', 'c1' hbase> get_counter 't1', 'r1', 'c1' @@ -36,11 +36,11 @@ t to table 't1', the corresponding command would be: EOF end - def command(table, row, column, value) - get_counter(table(table), row, column, value) + def command(table, row, column) + get_counter(table(table), row, column) end - def get_counter(table, row, column, value = nil) + def get_counter(table, row, column) if cnt = table._get_counter_internal(row, column) puts "COUNTER VALUE = #{cnt}" else diff --git a/hbase-shell/src/main/ruby/shell/commands/incr.rb b/hbase-shell/src/main/ruby/shell/commands/incr.rb index a59869c..d223a45 100644 --- a/hbase-shell/src/main/ruby/shell/commands/incr.rb +++ b/hbase-shell/src/main/ruby/shell/commands/incr.rb @@ -50,7 +50,11 @@ EOF def incr(table, row, column, value = nil, args={}) format_simple_command do - table._incr_internal(row, column, value, args) + if cnt = table._incr_internal(row, column, value, args) + puts "COUNTER VALUE = #{cnt}" + else + puts "No counter found at specified coordinates" + end end end end -- 2.1.3