mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Fix even more trash
This commit is contained in:
parent
9b908a0be0
commit
8e684170fe
@ -23,6 +23,8 @@ public:
|
||||
void formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const override;
|
||||
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTAlterNamedCollectionQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Alter; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -289,4 +289,9 @@ ASTPtr ASTBackupQuery::getRewrittenASTWithoutOnCluster(const WithoutOnClusterAST
|
||||
return new_query;
|
||||
}
|
||||
|
||||
IAST::QueryKind ASTBackupQuery::getQueryKind() const
|
||||
{
|
||||
return kind == Kind::BACKUP ? QueryKind::Backup : QueryKind::Restore;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -93,5 +93,6 @@ public:
|
||||
ASTPtr clone() const override;
|
||||
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override;
|
||||
QueryKind getQueryKind() const override;
|
||||
};
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ struct ASTCheckQuery : public ASTQueryWithTableAndOutput
|
||||
return res;
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Check; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
|
||||
{
|
||||
|
@ -25,6 +25,8 @@ public:
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateFunctionQuery>(clone()); }
|
||||
|
||||
String getFunctionName() const;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateNamedCollectionQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
|
||||
std::string getCollectionName() const;
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@ class ASTDeleteQuery : public ASTQueryWithTableAndOutput
|
||||
public:
|
||||
String getID(char delim) const final;
|
||||
ASTPtr clone() const final;
|
||||
QueryKind getQueryKind() const override { return QueryKind::Delete; }
|
||||
|
||||
ASTPtr predicate;
|
||||
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
void formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const override;
|
||||
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTDropFunctionQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Drop; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace DB
|
||||
/** Get the text that identifies this element. */
|
||||
String ASTDropIndexQuery::getID(char delim) const
|
||||
{
|
||||
return "CreateIndexQuery" + (delim + getDatabase()) + delim + getTable();
|
||||
return "DropIndexQuery" + (delim + getDatabase()) + delim + getTable();
|
||||
}
|
||||
|
||||
ASTPtr ASTDropIndexQuery::clone() const
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
void formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const override;
|
||||
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTDropNamedCollectionQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Drop; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
const ASTPtr & getTableFunction() const { return table_function; }
|
||||
const ASTPtr & getTableOverride() const { return table_override; }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Explain; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <Parsers/ASTFunction.h>
|
||||
#include <Parsers/IAST.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -38,6 +39,8 @@ public:
|
||||
from->formatImpl(settings, state, stacked);
|
||||
external_ddl->formatImpl(settings, state, stacked);
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::ExternalDDL; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
{
|
||||
return removeOnCluster<ASTKillQueryQuery>(clone());
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::KillQuery; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
{
|
||||
return removeOnCluster<ASTOptimizeQuery>(clone(), params.default_database);
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Optimize; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Show; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
|
||||
{
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
||||
|
||||
void updateTreeHashImpl(SipHash & hash_state) const override;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Set; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
|
||||
ASTPtr clone() const override;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Show; }
|
||||
|
||||
protected:
|
||||
void formatLike(const FormatSettings & settings) const;
|
||||
void formatLimit(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const;
|
||||
|
@ -24,6 +24,21 @@ void ASTTransactionControl::formatImpl(const FormatSettings & format /*state*/,
|
||||
}
|
||||
}
|
||||
|
||||
IAST::QueryKind ASTTransactionControl::getQueryKind() const
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case BEGIN:
|
||||
return QueryKind::Begin;
|
||||
case COMMIT:
|
||||
return QueryKind::Commit;
|
||||
case ROLLBACK:
|
||||
return QueryKind::Rollback;
|
||||
case SET_SNAPSHOT:
|
||||
return QueryKind::SetTransactionSnapshot;
|
||||
}
|
||||
}
|
||||
|
||||
void ASTTransactionControl::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
hash_state.update(action);
|
||||
|
@ -27,6 +27,8 @@ public:
|
||||
|
||||
void formatImpl(const FormatSettings & format, FormatState & /*state*/, FormatStateStacked /*frame*/) const override;
|
||||
void updateTreeHashImpl(SipHash & hash_state) const override;
|
||||
|
||||
QueryKind getQueryKind() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
|
||||
ASTPtr clone() const override { return std::make_shared<ASTUseQuery>(*this); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Use; }
|
||||
|
||||
protected:
|
||||
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
|
||||
{
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const override
|
||||
{
|
||||
|
@ -55,5 +55,7 @@ public:
|
||||
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
void replaceCurrentUserTag(const String & current_user_name) const;
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateQuotaQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
}
|
||||
|
@ -35,5 +35,7 @@ public:
|
||||
ASTPtr clone() const override;
|
||||
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateRoleQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
}
|
||||
|
@ -51,5 +51,7 @@ public:
|
||||
|
||||
void replaceCurrentUserTag(const String & current_user_name) const;
|
||||
void replaceEmptyDatabase(const String & current_database) const;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
}
|
||||
|
@ -41,5 +41,6 @@ public:
|
||||
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
||||
void replaceCurrentUserTag(const String & current_user_name) const;
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateSettingsProfileQuery>(clone()); }
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
}
|
||||
|
@ -63,5 +63,7 @@ public:
|
||||
void formatImpl(const FormatSettings & format, FormatState &, FormatStateStacked) const override;
|
||||
bool hasSecretParts() const override;
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTCreateUserQuery>(clone()); }
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Create; }
|
||||
};
|
||||
}
|
||||
|
@ -29,5 +29,7 @@ public:
|
||||
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams &) const override { return removeOnCluster<ASTDropAccessEntityQuery>(clone()); }
|
||||
|
||||
void replaceEmptyDatabase(const String & current_database) const;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Drop; }
|
||||
};
|
||||
}
|
||||
|
@ -27,5 +27,7 @@ public:
|
||||
String getID(char) const override;
|
||||
ASTPtr clone() const override;
|
||||
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Set; }
|
||||
};
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
void replaceEmptyDatabase(const String & current_database);
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Show; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
|
||||
void replaceEmptyDatabase(const String & current_database);
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Show; }
|
||||
|
||||
protected:
|
||||
String getKeyword() const;
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
|
@ -17,5 +17,7 @@ public:
|
||||
String getID(char) const override;
|
||||
ASTPtr clone() const override;
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Show; }
|
||||
};
|
||||
}
|
||||
|
@ -253,15 +253,32 @@ public:
|
||||
enum class QueryKind : uint8_t
|
||||
{
|
||||
None = 0,
|
||||
Alter,
|
||||
Select,
|
||||
Insert,
|
||||
Delete,
|
||||
Create,
|
||||
Drop,
|
||||
Grant,
|
||||
Insert,
|
||||
Rename,
|
||||
Optimize,
|
||||
Check,
|
||||
Alter,
|
||||
Grant,
|
||||
Revoke,
|
||||
Select,
|
||||
System,
|
||||
Set,
|
||||
Use,
|
||||
Show,
|
||||
Exists,
|
||||
Describe,
|
||||
Explain,
|
||||
Backup,
|
||||
Restore,
|
||||
KillQuery,
|
||||
ExternalDDL,
|
||||
Begin,
|
||||
Commit,
|
||||
Rollback,
|
||||
SetTransactionSnapshot,
|
||||
};
|
||||
/// Return QueryKind of this AST query.
|
||||
virtual QueryKind getQueryKind() const { return QueryKind::None; }
|
||||
|
@ -91,6 +91,8 @@ protected:
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << ASTExistsDatabaseQueryIDAndQueryNames::Query
|
||||
<< " " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(getDatabase());
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Exists; }
|
||||
};
|
||||
|
||||
class ASTShowCreateDatabaseQuery : public ASTQueryWithTableAndOutputImpl<ASTShowCreateDatabaseQueryIDAndQueryNames>
|
||||
@ -123,6 +125,8 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
QueryKind getQueryKind() const override { return QueryKind::Describe; }
|
||||
|
||||
protected:
|
||||
void formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user