use of com.facebook.presto.raptor.metadata.TableStatsRow in project presto by prestodb.
the class TableStatsSystemTable method buildPages.
private static List<Page> buildPages(MetadataDao dao, TupleDomain<Integer> tupleDomain) {
Map<Integer, NullableValue> domainValues = extractFixedValues(tupleDomain).orElse(ImmutableMap.of());
String schemaName = getStringValue(domainValues.get(getColumnIndex(METADATA, SCHEMA_NAME)));
String tableName = getStringValue(domainValues.get(getColumnIndex(METADATA, TABLE_NAME)));
PageListBuilder pageBuilder = new PageListBuilder(METADATA.getColumns().stream().map(ColumnMetadata::getType).collect(toList()));
for (TableStatsRow row : dao.getTableStatsRows(schemaName, tableName)) {
pageBuilder.beginRow();
VARCHAR.writeSlice(pageBuilder.nextBlockBuilder(), utf8Slice(row.getSchemaName()));
VARCHAR.writeSlice(pageBuilder.nextBlockBuilder(), utf8Slice(row.getTableName()));
TIMESTAMP.writeLong(pageBuilder.nextBlockBuilder(), row.getCreateTime());
TIMESTAMP.writeLong(pageBuilder.nextBlockBuilder(), row.getUpdateTime());
BIGINT.writeLong(pageBuilder.nextBlockBuilder(), row.getTableVersion());
BIGINT.writeLong(pageBuilder.nextBlockBuilder(), row.getShardCount());
BIGINT.writeLong(pageBuilder.nextBlockBuilder(), row.getRowCount());
BIGINT.writeLong(pageBuilder.nextBlockBuilder(), row.getCompressedSize());
BIGINT.writeLong(pageBuilder.nextBlockBuilder(), row.getUncompressedSize());
}
return pageBuilder.build();
}
Aggregations