From 4b77c00e4ff6c72eb5ac5c180c476c21d23a83a8 Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Sun, 2 Aug 2020 23:50:51 +0530 Subject: [PATCH] HBASE-24704 Make Table Schema easier to view with multiple families Closes #2185 Signed-off-by: Viraj Jasani --- .../resources/hbase-webapps/master/table.jsp | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index 3d5e2303bc8..1f160ea45ec 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -27,6 +27,8 @@ import="java.util.List" import="java.util.LinkedHashMap" import="java.util.Map" + import="java.util.Set" + import="java.util.HashSet" import="java.util.Collections" import="java.util.Collection" import="org.apache.commons.lang.StringEscapeUtils" @@ -45,6 +47,7 @@ import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator" import="org.apache.hadoop.hbase.util.Bytes" import="org.apache.hadoop.hbase.util.FSUtils" + import="org.apache.hadoop.hbase.io.ImmutableBytesWritable" import="org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest" import="org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState" import="org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos" @@ -417,40 +420,45 @@ if ( fqtn != null ) {

Table Schema

+<% + Collection families = table.getTableDescriptor().getFamilies(); + Set familyKeySet = new HashSet<>(); + for (HColumnDescriptor family: families) { + familyKeySet.addAll(family.getValues().keySet()); + } +%> - - - - <% - Collection families = table.getTableDescriptor().getFamilies(); - for (HColumnDescriptor family: families) { - %> - - - - - <% } %>
Column Family Name
<%= StringEscapeUtils.escapeHtml(family.getNameAsString()) %> - - - - - + <% - Map familyValues = family.getValues(); - for (ImmutableBytesWritable familyKey: familyValues.keySet()) { - final ImmutableBytesWritable familyValue = familyValues.get(familyKey); + for (HColumnDescriptor family: families) { + %> + + <% } %> + + <% + for (ImmutableBytesWritable familyKey: familyKeySet) { %> - + <% + for (HColumnDescriptor family: families) { + String familyValueStr = "-"; + Map familyValues = family.getValues(); + if(familyValues.containsKey(familyKey)){ + final ImmutableBytesWritable familyValue = familyValues.get(familyKey); + familyValueStr = Bytes.toString(familyValue.get(), familyValue.getOffset(), familyValue.getLength()); + } + %> + + <% } %> <% } %> -
PropertyValue
Property \ Column Family Name + <%= StringEscapeUtils.escapeHtml(family.getNameAsString()) %> +
<%= StringEscapeUtils.escapeHtml(Bytes.toString(familyKey.get(), familyKey.getOffset(), familyKey.getLength())) %> - - <%= StringEscapeUtils.escapeHtml(Bytes.toString(familyValue.get(), familyValue.getOffset(), familyValue.getLength())) %> + <%= StringEscapeUtils.escapeHtml(familyValueStr) %> +
-
<% long totalReadReq = 0;