HBASE-24704 Make Table Schema easier to view with multiple families
Closes #2185 Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
6e34609376
commit
9e975d1b98
|
@ -27,6 +27,8 @@
|
||||||
import="java.util.List"
|
import="java.util.List"
|
||||||
import="java.util.LinkedHashMap"
|
import="java.util.LinkedHashMap"
|
||||||
import="java.util.Map"
|
import="java.util.Map"
|
||||||
|
import="java.util.Set"
|
||||||
|
import="java.util.HashSet"
|
||||||
import="java.util.Collections"
|
import="java.util.Collections"
|
||||||
import="java.util.Collection"
|
import="java.util.Collection"
|
||||||
import="org.apache.commons.lang.StringEscapeUtils"
|
import="org.apache.commons.lang.StringEscapeUtils"
|
||||||
|
@ -45,6 +47,7 @@
|
||||||
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
|
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
|
||||||
import="org.apache.hadoop.hbase.util.Bytes"
|
import="org.apache.hadoop.hbase.util.Bytes"
|
||||||
import="org.apache.hadoop.hbase.util.FSUtils"
|
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.regionserver.compactions.CompactionRequest"
|
||||||
import="org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState"
|
import="org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState"
|
||||||
import="org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos"
|
import="org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos"
|
||||||
|
@ -417,38 +420,43 @@ if ( fqtn != null ) {
|
||||||
</table>
|
</table>
|
||||||
<h2>Table Schema</h2>
|
<h2>Table Schema</h2>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
|
||||||
<th>Column Family Name</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
<%
|
<%
|
||||||
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
|
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
|
||||||
|
Set<ImmutableBytesWritable> familyKeySet = new HashSet<>();
|
||||||
for (HColumnDescriptor family: families) {
|
for (HColumnDescriptor family: families) {
|
||||||
|
familyKeySet.addAll(family.getValues().keySet());
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= StringEscapeUtils.escapeHtml(family.getNameAsString()) %></td>
|
<th>Property \ Column Family Name</th>
|
||||||
<td>
|
<%
|
||||||
<table class="table table-striped">
|
for (HColumnDescriptor family: families) {
|
||||||
<tr>
|
%>
|
||||||
<th>Property</th>
|
<th>
|
||||||
<th>Value</th>
|
<%= StringEscapeUtils.escapeHtml(family.getNameAsString()) %>
|
||||||
|
</th>
|
||||||
|
<% } %>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
Map<ImmutableBytesWritable, ImmutableBytesWritable> familyValues = family.getValues();
|
for (ImmutableBytesWritable familyKey: familyKeySet) {
|
||||||
for (ImmutableBytesWritable familyKey: familyValues.keySet()) {
|
|
||||||
final ImmutableBytesWritable familyValue = familyValues.get(familyKey);
|
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= StringEscapeUtils.escapeHtml(Bytes.toString(familyKey.get(), familyKey.getOffset(), familyKey.getLength())) %>
|
<%= StringEscapeUtils.escapeHtml(Bytes.toString(familyKey.get(), familyKey.getOffset(), familyKey.getLength())) %>
|
||||||
</td>
|
</td>
|
||||||
|
<%
|
||||||
|
for (HColumnDescriptor family: families) {
|
||||||
|
String familyValueStr = "-";
|
||||||
|
Map<ImmutableBytesWritable, ImmutableBytesWritable> familyValues = family.getValues();
|
||||||
|
if(familyValues.containsKey(familyKey)){
|
||||||
|
final ImmutableBytesWritable familyValue = familyValues.get(familyKey);
|
||||||
|
familyValueStr = Bytes.toString(familyValue.get(), familyValue.getOffset(), familyValue.getLength());
|
||||||
|
}
|
||||||
|
%>
|
||||||
<td>
|
<td>
|
||||||
<%= StringEscapeUtils.escapeHtml(Bytes.toString(familyValue.get(), familyValue.getOffset(), familyValue.getLength())) %>
|
<%= StringEscapeUtils.escapeHtml(familyValueStr) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
|
||||||
<% } %>
|
<% } %>
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue