HBASE-12832 Describe table from shell no longer shows Table's attributes, only CF attributes (Srikanth Srungarapu)

This commit is contained in:
Enis Soztutar 2015-01-12 13:59:44 -08:00
parent e52d8f85c4
commit 8816fa05c2
3 changed files with 13 additions and 1 deletions

View File

@ -860,6 +860,13 @@ public class HTableDescriptor implements Comparable<HTableDescriptor> {
return s.toString(); return s.toString();
} }
/**
* @return map of all table attributes formatted into string.
*/
public String toStringTableAttributes() {
return getValues(true).toString();
}
private StringBuilder getValues(boolean printDefaults) { private StringBuilder getValues(boolean printDefaults) {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();

View File

@ -362,6 +362,10 @@ module Hbase
@admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies() @admin.getTableDescriptor(TableName.valueOf(table_name)).getColumnFamilies()
end end
def get_table_attributes(table_name)
@admin.getTableDescriptor(TableName.valueOf(table_name)).toStringTableAttributes
end
#---------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------
# Truncates table (deletes all records by recreating the table) # Truncates table (deletes all records by recreating the table)
def truncate(table_name, conf = @conf) def truncate(table_name, conf = @conf)

View File

@ -38,7 +38,8 @@ EOF
column_families = admin.get_column_families(table) 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(["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| column_families.each do |column_family|
formatter.row([ column_family.to_s ], true) formatter.row([ column_family.to_s ], true)
end end