mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
70ea507dae
Extended OPTIMIZE ... DEDUPLICATE syntax to allow explicit (or implicit with asterisk/column transformers) list of columns to check for duplicates on. Following syntax variants are now supported: OPTIMIZE TABLE table DEDUPLICATE; -- the old one OPTIMIZE TABLE table DEDUPLICATE BY *; OPTIMIZE TABLE table DEDUPLICATE BY * EXCEPT colX; OPTIMIZE TABLE table DEDUPLICATE BY * EXCEPT (colX, colY); OPTIMIZE TABLE table DEDUPLICATE BY col1,col2,col3; OPTIMIZE TABLE table DEDUPLICATE BY COLUMNS('column-matched-by-regex'); OPTIMIZE TABLE table DEDUPLICATE BY COLUMNS('column-matched-by-regex') EXCEPT colX; OPTIMIZE TABLE table DEDUPLICATE BY COLUMNS('column-matched-by-regex') EXCEPT (colX, colY); Note that * behaves just like in SELECT: MATERIALIZED, and ALIAS columns are not used for expansion. Also, it is an error to specify empty list of columns, or write an expression that results in an empty list of columns, or deduplicate by an ALIAS column. Column transformers other than EXCEPT are not supported.
27 lines
677 B
C++
27 lines
677 B
C++
#pragma once
|
|
|
|
#include <Parsers/IParserBase.h>
|
|
#include <Parsers/ExpressionElementParsers.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class ParserOptimizeQueryColumnsSpecification : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "column specification for OPTIMIZE ... DEDUPLICATE BY"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
/** Query OPTIMIZE TABLE [db.]name [PARTITION partition] [FINAL] [DEDUPLICATE]
|
|
*/
|
|
class ParserOptimizeQuery : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "OPTIMIZE query"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
}
|