| 865 | } |
| 866 | |
| 867 | QueryTreeNodePtr QueryTreeBuilder::buildWindow(const ASTPtr & window_definition, const ContextPtr & context) const |
| 868 | { |
| 869 | const auto & window_definition_typed = window_definition->as<const ASTWindowDefinition &>(); |
| 870 | WindowFrame window_frame; |
| 871 | |
| 872 | if (!window_definition_typed.frame_is_default) |
| 873 | { |
| 874 | window_frame.is_default = false; |
| 875 | window_frame.type = window_definition_typed.frame_type; |
| 876 | window_frame.begin_type = window_definition_typed.frame_begin_type; |
| 877 | window_frame.begin_preceding = window_definition_typed.frame_begin_preceding; |
| 878 | window_frame.end_type = window_definition_typed.frame_end_type; |
| 879 | window_frame.end_preceding = window_definition_typed.frame_end_preceding; |
| 880 | } |
| 881 | |
| 882 | auto window_node = std::make_shared<WindowNode>(window_frame); |
| 883 | window_node->setParentWindowName(window_definition_typed.parent_window_name); |
| 884 | |
| 885 | if (window_definition_typed.partition_by) |
| 886 | window_node->getPartitionByNode() = buildExpressionList(window_definition_typed.partition_by, context); |
| 887 | |
| 888 | if (window_definition_typed.order_by) |
| 889 | window_node->getOrderByNode() = buildSortList(window_definition_typed.order_by, context); |
| 890 | |
| 891 | if (window_definition_typed.frame_begin_offset) |
| 892 | window_node->getFrameBeginOffsetNode() = buildExpression(window_definition_typed.frame_begin_offset, context); |
| 893 | |
| 894 | if (window_definition_typed.frame_end_offset) |
| 895 | window_node->getFrameEndOffsetNode() = buildExpression(window_definition_typed.frame_end_offset, context); |
| 896 | |
| 897 | window_node->setOriginalAST(window_definition); |
| 898 | |
| 899 | return window_node; |
| 900 | } |
| 901 | |
| 902 | std::shared_ptr<TableFunctionNode> QueryTreeBuilder::buildTableFunction(const ASTPtr & table_function, const ContextPtr & context) const |
| 903 | { |
nothing calls this directly
no test coverage detected