Skip to content

Commit 492cf10

Browse files
bsglzvirajjasani
authored andcommitted
HBASE-24704 Make Table Schema easier to view with multiple families
Closes #2042 Signed-off-by: Viraj Jasani <vjasani@apache.org>
1 parent 86ebbdd commit 492cf10

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

  • hbase-server/src/main/resources/hbase-webapps/master

hbase-server/src/main/resources/hbase-webapps/master/table.jsp

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
import="java.util.LinkedHashMap"
2727
import="java.util.List"
2828
import="java.util.Map"
29+
import="java.util.Set"
30+
import="java.util.HashSet"
2931
import="java.util.Optional"
3032
import="java.util.TreeMap"
3133
import="java.util.concurrent.TimeUnit"
3234
import="org.apache.commons.lang3.StringEscapeUtils"
3335
import="org.apache.hadoop.conf.Configuration"
34-
import="org.apache.hadoop.hbase.HColumnDescriptor"
3536
import="org.apache.hadoop.hbase.HConstants"
3637
import="org.apache.hadoop.hbase.HRegionLocation"
3738
import="org.apache.hadoop.hbase.HTableDescriptor"
@@ -51,6 +52,7 @@
5152
import="org.apache.hadoop.hbase.client.RegionLocator"
5253
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
5354
import="org.apache.hadoop.hbase.client.Table"
55+
import="org.apache.hadoop.hbase.client.ColumnFamilyDescriptor"
5456
import="org.apache.hadoop.hbase.http.InfoServer"
5557
import="org.apache.hadoop.hbase.master.HMaster"
5658
import="org.apache.hadoop.hbase.master.RegionState"
@@ -771,40 +773,45 @@
771773
%>
772774
</table>
773775
<h2>Table Schema</h2>
776+
774777
<table class="table table-striped">
778+
<%
779+
ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies();
780+
Set<Bytes> familyKeySet = new HashSet<>();
781+
for (ColumnFamilyDescriptor family: families) {
782+
familyKeySet.addAll(family.getValues().keySet());
783+
}
784+
%>
775785
<tr>
776-
<th>Column Family Name</th>
777-
<th></th>
786+
<th>Property \ Column Family Name</th>
787+
<%
788+
for (ColumnFamilyDescriptor family: families) {
789+
%>
790+
<th>
791+
<%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %>
792+
</th>
793+
<% } %>
778794
</tr>
779-
<%
780-
Collection<HColumnDescriptor> families = new HTableDescriptor(table.getDescriptor()).getFamilies();
781-
for (HColumnDescriptor family: families) {
782-
%>
783-
<tr>
784-
<td><%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %></td>
785-
<td>
786-
<table class="table table-striped">
787-
<tr>
788-
<th>Property</th>
789-
<th>Value</th>
790-
</tr>
791795
<%
792-
Map<Bytes, Bytes> familyValues = family.getValues();
793-
for (Bytes familyKey: familyValues.keySet()) {
796+
for (Bytes familyKey: familyKeySet) {
794797
%>
795798
<tr>
796799
<td>
797800
<%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %>
798-
</td>
801+
</td>
802+
<%
803+
for (ColumnFamilyDescriptor family: families) {
804+
String familyValue = "-";
805+
if(family.getValues().containsKey(familyKey)){
806+
familyValue = family.getValues().get(familyKey).toString();
807+
}
808+
%>
799809
<td>
800-
<%= StringEscapeUtils.escapeHtml4(familyValues.get(familyKey).toString()) %>
810+
<%= StringEscapeUtils.escapeHtml4(familyValue) %>
801811
</td>
812+
<% } %>
802813
</tr>
803814
<% } %>
804-
</table>
805-
</td>
806-
</tr>
807-
<% } %>
808815
</table>
809816
<%
810817
long totalReadReq = 0;

0 commit comments

Comments
 (0)