use of io.trino.plugin.raptor.legacy.metadata.TableStatsRow in project trino by trinodb.
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_MILLIS.writeLong(pageBuilder.nextBlockBuilder(), row.getCreateTime() * MICROSECONDS_PER_MILLISECOND);
TIMESTAMP_MILLIS.writeLong(pageBuilder.nextBlockBuilder(), row.getUpdateTime() * MICROSECONDS_PER_MILLISECOND);
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