Repository: hbase Updated Branches: refs/heads/0.98 2f841de98 -> 3f779c9f3
HBASE-12832 Describe table from shell no longer shows Table's attributes, only CF attributes (Srikanth Srungarapu) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3f779c9f Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3f779c9f Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3f779c9f Branch: refs/heads/0.98 Commit: 3f779c9f39df3d57c041b028e24a3115d629c98f Parents: 2f841de Author: Enis Soztutar <e...@apache.org> Authored: Mon Jan 12 13:59:44 2015 -0800 Committer: Enis Soztutar <e...@apache.org> Committed: Mon Jan 12 14:07:16 2015 -0800 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/hbase/HTableDescriptor.java | 7 +++++++ hbase-shell/src/main/ruby/hbase/admin.rb | 4 ++++ hbase-shell/src/main/ruby/shell/commands/describe.rb | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/3f779c9f/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java index f3df203..63056d1 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java @@ -835,6 +835,13 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> { return s.toString(); } + /** + * @return map of all table attributes formatted into string. + */ + public String toStringTableAttributes() { + return getValues(true).toString(); + } + private StringBuilder getValues(boolean printDefaults) { StringBuilder s = new StringBuilder(); http://git-wip-us.apache.org/repos/asf/hbase/blob/3f779c9f/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 b30b1a9..ff3770e 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -345,6 +345,10 @@ module Hbase @admin.getTableDescriptor(table_name.to_java_bytes).getColumnFamilies() end + def get_table_attributes(table_name) + @admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes + 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/3f779c9f/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 39a30c1..bfa16cd 100644 --- a/hbase-shell/src/main/ruby/shell/commands/describe.rb +++ b/hbase-shell/src/main/ruby/shell/commands/describe.rb @@ -38,7 +38,8 @@ EOF column_families = admin.get_column_families(table) formatter.header(["Table " + table.to_s + " is " + if admin.enabled?(table) then "ENABLED" else "DISABLED" end]) - formatter.header([ "COLUMN FAMILIES DESCRIPTION" ]) + formatter.row([table.to_s + admin.get_table_attributes(table)], true) + formatter.header(["COLUMN FAMILIES DESCRIPTION"]) column_families.each do |column_family| formatter.row([ column_family.to_s ], true) end