| 483 | |
| 484 | |
| 485 | BlockIO InterpreterShowStatsQuery::executeTable() |
| 486 | { |
| 487 | auto query = query_ptr->as<const ASTShowStatsQuery>(); |
| 488 | auto context = getContext(); |
| 489 | auto catalog = Statistics::createCatalogAdaptor(context); |
| 490 | auto tables = getTablesFromAST(context, query); |
| 491 | std::vector<FormattedOutputData> result; |
| 492 | for (auto & table : tables) |
| 493 | { |
| 494 | FormattedOutputData data; |
| 495 | auto obj = getTableStatistics(context, table); |
| 496 | auto storage = catalog->getStorageByTableId(table); |
| 497 | data.append("database", table.getDatabaseName()); |
| 498 | data.append("table", table.getTableName()); |
| 499 | data.append("engine", storage->getName()); |
| 500 | data.append("unique_key", UUIDHelpers::UUIDToString(table.getUniqueKey())); |
| 501 | data.append("row_count", obj ? std::to_string(obj->getRowCount()) : ""); |
| 502 | data.append("timestamp", obj ? AutoStats::serializeToText(obj->getTimestamp()) : ""); |
| 503 | result.emplace_back(std::move(data)); |
| 504 | } |
| 505 | |
| 506 | auto block = outputFormattedBlock(result, {"database", "table", "engine", "unique_key", "row_count", "timestamp"}); |
| 507 | BlocksList list = {std::move(block)}; |
| 508 | BlockIO res; |
| 509 | // res.in = std::make_shared<Block>(sample_block.cloneWithColumns(std::move(res_columns))); |
| 510 | res.in = std::make_shared<BlocksListBlockInputStream>(std::move(list)); |
| 511 | return res; |
| 512 | } |
| 513 | |
| 514 | BlockIO InterpreterShowStatsQuery::execute() |
| 515 | { |
nothing calls this directly
no test coverage detected