use of org.apache.hadoop.hive.ql.ddl.ShowUtils.LINE_DELIM in project hive by apache.
the class TextDescTableFormatter method getViewInfo.
private void getViewInfo(StringBuilder tableInfo, Table table, boolean isOutputPadded) {
formatOutput("Original Query:", table.getViewOriginalText(), tableInfo);
formatOutput("Expanded Query:", table.getViewExpandedText(), tableInfo);
if (table.isMaterializedView()) {
formatOutput("Rewrite Enabled:", table.isRewriteEnabled() ? "Yes" : "No", tableInfo);
formatOutput("Outdated for Rewriting:", table.isOutdatedForRewriting() == null ? "Unknown" : table.isOutdatedForRewriting() ? "Yes" : "No", tableInfo);
tableInfo.append(LINE_DELIM).append("# Materialized View Source table information").append(LINE_DELIM);
TextMetaDataTable metaDataTable = new TextMetaDataTable();
metaDataTable.addRow("Table name", "I/U/D since last rebuild");
List<SourceTable> sourceTableList = new ArrayList<>(table.getMVMetadata().getSourceTables());
sourceTableList.sort(Comparator.<SourceTable, String>comparing(sourceTable -> sourceTable.getTable().getDbName()).thenComparing(sourceTable -> sourceTable.getTable().getTableName()));
for (SourceTable sourceTable : sourceTableList) {
String qualifiedTableName = TableName.getQualified(sourceTable.getTable().getCatName(), sourceTable.getTable().getDbName(), sourceTable.getTable().getTableName());
metaDataTable.addRow(qualifiedTableName, String.format("%d/%d/%d", sourceTable.getInsertedCount(), sourceTable.getUpdatedCount(), sourceTable.getDeletedCount()));
}
tableInfo.append(metaDataTable.renderTable(isOutputPadded));
}
}
Aggregations