MCPcopy Create free account
hub / github.com/ByConity/ByConity / executeTable

Method executeTable

src/Interpreters/InterpreterShowStatsQuery.cpp:485–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483
484
485BlockIO 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
514BlockIO InterpreterShowStatsQuery::execute()
515{

Callers

nothing calls this directly

Calls 15

createCatalogAdaptorFunction · 0.85
getTablesFromASTFunction · 0.85
getTableStatisticsFunction · 0.85
UUIDToStringFunction · 0.85
serializeToTextFunction · 0.85
outputFormattedBlockFunction · 0.85
getUniqueKeyMethod · 0.80
to_stringFunction · 0.50
getStorageByTableIdMethod · 0.45
appendMethod · 0.45
getDatabaseNameMethod · 0.45
getTableNameMethod · 0.45

Tested by

no test coverage detected