Repository: hbase Updated Branches: refs/heads/master a0bb3fbc9 -> 3e073924b
HBASE-10082 Describe 'table' output is all on one line, could use better formatting (Srikanth Srungarapu) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3e073924 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3e073924 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3e073924 Branch: refs/heads/master Commit: 3e073924be3c8e55229b0da018593dad4f30e0b3 Parents: a0bb3fb Author: stack <st...@apache.org> Authored: Mon Oct 20 20:17:56 2014 -0700 Committer: stack <st...@apache.org> Committed: Mon Oct 20 20:18:07 2014 -0700 ---------------------------------------------------------------------- hbase-shell/src/main/ruby/hbase/admin.rb | 5 ++++- hbase-shell/src/main/ruby/shell/commands/describe.rb | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/3e073924/hbase-shell/src/main/ruby/hbase/admin.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index 77c2759..a242846 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -23,7 +23,6 @@ java_import org.apache.hadoop.hbase.util.Pair java_import org.apache.hadoop.hbase.util.RegionSplitter java_import org.apache.hadoop.hbase.util.Bytes java_import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos::SnapshotDescription -java_import org.apache.commons.collections.MapUtils # Wrapper for org.apache.hadoop.hbase.client.HBaseAdmin @@ -332,6 +331,10 @@ module Hbase @admin.getTableDescriptor(table_name.to_java_bytes).to_s end + def get_column_families(table_name) + @admin.getTableDescriptor(table_name.to_java_bytes).getColumnFamilies() + end + #---------------------------------------------------------------------------------------------- # Truncates table (deletes all records by recreating the table) def truncate(table_name, conf = @conf) http://git-wip-us.apache.org/repos/asf/hbase/blob/3e073924/hbase-shell/src/main/ruby/shell/commands/describe.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/shell/commands/describe.rb b/hbase-shell/src/main/ruby/shell/commands/describe.rb index 9e48491..39a30c1 100644 --- a/hbase-shell/src/main/ruby/shell/commands/describe.rb +++ b/hbase-shell/src/main/ruby/shell/commands/describe.rb @@ -28,17 +28,20 @@ Describe the named table. For example: Alternatively, you can use the abbreviated 'desc' for the same thing. hbase> desc 't1' - hbase> desc 'nds1:t1' + hbase> desc 'ns1:t1' EOF end def command(table) now = Time.now - desc = admin.describe(table) + column_families = admin.get_column_families(table) - formatter.header([ "DESCRIPTION", "ENABLED" ], [ 64 ]) - formatter.row([ desc, admin.enabled?(table).to_s ], true, [ 64 ]) + formatter.header(["Table " + table.to_s + " is " + if admin.enabled?(table) then "ENABLED" else "DISABLED" end]) + formatter.header([ "COLUMN FAMILIES DESCRIPTION" ]) + column_families.each do |column_family| + formatter.row([ column_family.to_s ], true) + end formatter.footer(now) end end