2017-09-06 20:34:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST.h>
|
2023-05-04 14:50:26 +00:00
|
|
|
#include <optional>
|
2017-09-06 20:34:26 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Either a (possibly compound) expression representing a partition value or a partition ID.
|
|
|
|
class ASTPartition : public IAST
|
|
|
|
{
|
|
|
|
public:
|
2023-10-13 14:22:18 +00:00
|
|
|
IAST * value{nullptr};
|
2023-10-13 14:52:04 +00:00
|
|
|
size_t fields_count;
|
2017-09-06 20:34:26 +00:00
|
|
|
|
2023-10-13 14:22:18 +00:00
|
|
|
IAST * id{nullptr};
|
2022-03-31 09:50:07 +00:00
|
|
|
bool all = false;
|
2017-09-06 20:34:26 +00:00
|
|
|
|
2018-12-07 12:34:40 +00:00
|
|
|
String getID(char) const override;
|
2017-09-06 20:34:26 +00:00
|
|
|
ASTPtr clone() const override;
|
|
|
|
|
2023-10-13 14:22:18 +00:00
|
|
|
void setPartitionID(const ASTPtr & ast);
|
|
|
|
void setPartitionValue(const ASTPtr & ast);
|
|
|
|
|
|
|
|
void forEachPointerToChild(std::function<void(void **)> f) override
|
|
|
|
{
|
|
|
|
f(reinterpret_cast<void **>(&value));
|
|
|
|
f(reinterpret_cast<void **>(&id));
|
|
|
|
}
|
|
|
|
|
2017-09-06 20:34:26 +00:00
|
|
|
protected:
|
|
|
|
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|