2020-07-06 13:57:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-11-26 18:27:16 +00:00
|
|
|
#include <IO/Operators.h>
|
2020-07-06 13:57:45 +00:00
|
|
|
#include <Parsers/ASTFunction.h>
|
2021-11-26 18:27:16 +00:00
|
|
|
#include <Parsers/IAST.h>
|
2020-07-06 13:57:45 +00:00
|
|
|
|
2023-02-02 01:11:16 +00:00
|
|
|
|
2020-07-06 13:57:45 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ASTExternalDDLQuery : public IAST
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ASTFunction * from;
|
|
|
|
ASTPtr external_ddl;
|
|
|
|
|
|
|
|
ASTPtr clone() const override
|
|
|
|
{
|
|
|
|
auto res = std::make_shared<ASTExternalDDLQuery>(*this);
|
|
|
|
res->children.clear();
|
|
|
|
|
|
|
|
if (from)
|
|
|
|
res->set(res->from, from->clone());
|
|
|
|
|
|
|
|
if (external_ddl)
|
|
|
|
{
|
|
|
|
res->external_ddl = external_ddl->clone();
|
|
|
|
res->children.emplace_back(res->external_ddl);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
String getID(char) const override { return "external ddl query"; }
|
|
|
|
|
|
|
|
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked stacked) const override
|
|
|
|
{
|
2020-08-06 04:03:27 +00:00
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << "EXTERNAL DDL FROM " << (settings.hilite ? hilite_none : "");
|
2020-07-06 13:57:45 +00:00
|
|
|
from->formatImpl(settings, state, stacked);
|
|
|
|
external_ddl->formatImpl(settings, state, stacked);
|
|
|
|
}
|
2023-02-02 01:11:16 +00:00
|
|
|
|
|
|
|
QueryKind getQueryKind() const override { return QueryKind::ExternalDDL; }
|
2023-03-11 19:16:06 +00:00
|
|
|
|
|
|
|
void forEachPointerToChild(std::function<void(void**)> f) override
|
|
|
|
{
|
|
|
|
f(reinterpret_cast<void **>(&from));
|
|
|
|
}
|
2020-07-06 13:57:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|