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

Method execute

src/Interpreters/InterpreterCreateQuery.cpp:1753–1790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1751}
1752
1753BlockIO InterpreterCreateQuery::execute()
1754{
1755 FunctionNameNormalizer().visit(query_ptr.get());
1756 auto & create = query_ptr->as<ASTCreateQuery &>();
1757 if (!create.cluster.empty())
1758 {
1759 prepareOnClusterQuery(create, getContext(), create.cluster);
1760 return executeDDLQueryOnCluster(query_ptr, getContext(), getRequiredAccess());
1761 }
1762
1763 auto context = getContext();
1764 context->checkAccess(getRequiredAccess());
1765 if (create.is_dictionary && context->is_tenant_user())
1766 {
1767 if (create.dictionary)
1768 {
1769 auto& refresh_query = create.dictionary->clickhouse_query;
1770 auto& invalidate_query = create.dictionary->clickhouse_invalidate_query;
1771 if (!refresh_query.empty())
1772 executeQuery("explain " + refresh_query, context, true);
1773 if (!invalidate_query.empty())
1774 executeQuery(invalidate_query, context, true);
1775 }
1776
1777 }
1778
1779 ASTQueryWithOutput::resetOutputASTIfExist(create);
1780
1781 if (!create.catalog.empty() && create.database.empty() && create.table.empty())
1782 return createExternalCatalog(create);
1783 else if (!create.catalog.empty() && (!create.database.empty() || !create.table.empty()))
1784 throw Exception("create database or table in externcal catalog is not supported", ErrorCodes::INCORRECT_QUERY );
1785 /// CREATE|ATTACH DATABASE
1786 else if (!create.database.empty() && create.table.empty())
1787 return createDatabase(create);
1788 else
1789 return createTable(create);
1790}
1791
1792
1793AccessRightsElements InterpreterCreateQuery::getRequiredAccess() const

Callers 3

doCreateTableMethod · 0.45
fillTableIfNeededMethod · 0.45

Calls 10

executeDDLQueryOnClusterFunction · 0.85
is_tenant_userMethod · 0.80
executeQueryFunction · 0.70
ExceptionClass · 0.70
createTableFunction · 0.50
visitMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
checkAccessMethod · 0.45

Tested by

no test coverage detected