1#include <Parsers/ASTOptimizeQuery.h>
2#include <Common/quoteString.h>
3
4namespace DB
5{
6
7void ASTOptimizeQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
8{
9 settings.ostr << (settings.hilite ? hilite_keyword : "") << "OPTIMIZE TABLE " << (settings.hilite ? hilite_none : "")
10 << (!database.empty() ? backQuoteIfNeed(database) + "." : "") << backQuoteIfNeed(table);
11
12 formatOnCluster(settings);
13
14 if (partition)
15 {
16 settings.ostr << (settings.hilite ? hilite_keyword : "") << " PARTITION " << (settings.hilite ? hilite_none : "");
17 partition->formatImpl(settings, state, frame);
18 }
19
20 if (final)
21 settings.ostr << (settings.hilite ? hilite_keyword : "") << " FINAL" << (settings.hilite ? hilite_none : "");
22
23 if (deduplicate)
24 settings.ostr << (settings.hilite ? hilite_keyword : "") << " DEDUPLICATE" << (settings.hilite ? hilite_none : "");
25}
26
27}
28