| 53 | } |
| 54 | |
| 55 | ASTPtr ArrayJoinNode::toASTImpl(const ConvertToASTOptions & options) const |
| 56 | { |
| 57 | auto array_join_ast = make_intrusive<ASTArrayJoin>(); |
| 58 | array_join_ast->kind = is_left ? ASTArrayJoin::Kind::Left : ASTArrayJoin::Kind::Inner; |
| 59 | |
| 60 | auto array_join_expressions_ast = make_intrusive<ASTExpressionList>(); |
| 61 | const auto & array_join_expressions = getJoinExpressions().getNodes(); |
| 62 | |
| 63 | for (const auto & array_join_expression : array_join_expressions) |
| 64 | { |
| 65 | ASTPtr array_join_expression_ast; |
| 66 | |
| 67 | auto * column_node = array_join_expression->as<ColumnNode>(); |
| 68 | if (column_node && column_node->getExpression()) |
| 69 | { |
| 70 | array_join_expression_ast = column_node->getExpression()->toAST(options); |
| 71 | } |
| 72 | else |
| 73 | array_join_expression_ast = array_join_expression->toAST(options); |
| 74 | |
| 75 | /// We must check that it has an alias (not empty) as otherwise we try to set it and not all IAST classes support it (LOGICAL_ERROR) |
| 76 | if (array_join_expression->hasAlias()) |
| 77 | array_join_expression_ast->setAlias(array_join_expression->getAlias()); |
| 78 | array_join_expressions_ast->children.push_back(std::move(array_join_expression_ast)); |
| 79 | } |
| 80 | |
| 81 | array_join_ast->children.push_back(std::move(array_join_expressions_ast)); |
| 82 | array_join_ast->expression_list = array_join_ast->children.back(); |
| 83 | |
| 84 | ASTPtr tables_in_select_query_ast = make_intrusive<ASTTablesInSelectQuery>(); |
| 85 | addTableExpressionOrJoinIntoTablesInSelectQuery(tables_in_select_query_ast, children[table_expression_child_index], options); |
| 86 | |
| 87 | auto array_join_query_element_ast = make_intrusive<ASTTablesInSelectQueryElement>(); |
| 88 | array_join_query_element_ast->children.push_back(std::move(array_join_ast)); |
| 89 | array_join_query_element_ast->array_join = array_join_query_element_ast->children.back(); |
| 90 | |
| 91 | tables_in_select_query_ast->children.push_back(std::move(array_join_query_element_ast)); |
| 92 | |
| 93 | return tables_in_select_query_ast; |
| 94 | } |
| 95 | |
| 96 | } |
nothing calls this directly
no test coverage detected