2022-07-14 11:20:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Analyzer/IQueryTreeNode.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** List node represents list of query tree nodes in query tree.
|
|
|
|
*
|
|
|
|
* Example: SELECT column_1, 1, 'constant_value' FROM table.
|
|
|
|
* column_1, 1, 'constant_value' is list query tree node.
|
|
|
|
*/
|
|
|
|
class ListNode;
|
|
|
|
using ListNodePtr = std::shared_ptr<ListNode>;
|
|
|
|
|
|
|
|
class ListNode final : public IQueryTreeNode
|
|
|
|
{
|
|
|
|
public:
|
2023-01-18 17:14:03 +00:00
|
|
|
using iterator = QueryTreeNodes::iterator;
|
|
|
|
|
2022-08-15 16:34:10 +00:00
|
|
|
/// Initialize list node with empty nodes
|
2022-10-07 10:44:28 +00:00
|
|
|
ListNode();
|
2022-08-15 16:34:10 +00:00
|
|
|
|
|
|
|
/// Initialize list node with nodes
|
|
|
|
explicit ListNode(QueryTreeNodes nodes);
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
/// Get list nodes
|
|
|
|
const QueryTreeNodes & getNodes() const
|
|
|
|
{
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get list nodes
|
|
|
|
QueryTreeNodes & getNodes()
|
|
|
|
{
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryTreeNodeType getNodeType() const override
|
|
|
|
{
|
|
|
|
return QueryTreeNodeType::LIST;
|
|
|
|
}
|
|
|
|
|
2022-07-19 10:54:45 +00:00
|
|
|
void dumpTreeImpl(WriteBuffer & buffer, FormatState & format_state, size_t indent) const override;
|
|
|
|
|
2023-01-18 17:14:03 +00:00
|
|
|
iterator begin() { return children.begin(); }
|
|
|
|
iterator end() { return children.end(); }
|
|
|
|
|
2022-10-10 10:25:58 +00:00
|
|
|
protected:
|
2022-07-15 13:32:53 +00:00
|
|
|
bool isEqualImpl(const IQueryTreeNode & rhs) const override;
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
void updateTreeHashImpl(HashState &) const override;
|
|
|
|
|
|
|
|
QueryTreeNodePtr cloneImpl() const override;
|
2022-10-10 10:25:58 +00:00
|
|
|
|
|
|
|
ASTPtr toASTImpl() const override;
|
2022-07-14 11:20:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|