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

Method execute

src/Interpreters/InterpreterShowStatementsQuery.cpp:34–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34BlockIO InterpreterShowStatementsQuery::execute()
35{
36 if (!isQueryInInteractiveSession(getContext(), query_ptr))
37 {
38 throw Exception("SHOW STATEMENTS are supported only in interactive sessions", ErrorCodes::LOGICAL_ERROR);
39 }
40 auto * explicit_txn = getContext()->getSessionContext()->getCurrentTransaction()->as<CnchExplicitTransaction>();
41 const auto & statements = explicit_txn->getStatements();
42 const auto & txns = explicit_txn->getSecondaryTransactions();
43 assert(statements.size() == txns.size());
44 Block block;
45 auto block_structures = getBlockStructure();
46 for (auto & [name, type] : block_structures)
47 {
48 block.insert({type->createColumn(), type, name});
49 }
50 MutableColumns res_columns = block.cloneEmptyColumns();
51 for (size_t i = 0; i < statements.size(); ++i)
52 {
53 res_columns[0]->insert(txns[i]->getTransactionID().toUInt64());
54 res_columns[1]->insert(statements[i]);
55 res_columns[2]->insert(txnStatusToString(txns[i]->getStatus()));
56 }
57 BlockIO res;
58 res.in = std::make_shared<OneBlockInputStream>(block.cloneWithColumns(std::move(res_columns)));
59 return res;
60}
61}

Callers

nothing calls this directly

Calls 14

getBlockStructureFunction · 0.85
txnStatusToStringFunction · 0.85
getCurrentTransactionMethod · 0.80
toUInt64Method · 0.80
cloneWithColumnsMethod · 0.80
ExceptionClass · 0.70
getSessionContextMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
createColumnMethod · 0.45
cloneEmptyColumnsMethod · 0.45

Tested by

no test coverage detected