Normalize away WITH statement

This commit is contained in:
Amos Bird 2021-01-06 19:21:55 +08:00
parent b6a5d2f8e9
commit 9546e61bd4
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4

View File

@ -782,6 +782,9 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
normalize(query, result.aliases, settings);
// After normalization, we don't need WITH statement anymore
select_query->setExpression(ASTSelectQuery::Expression::WITH, {});
/// Remove unneeded columns according to 'required_result_columns'.
/// Leave all selected columns in case of DISTINCT; columns that contain arrayJoin function inside.
/// Must be after 'normalizeTree' (after expanding aliases, for aliases not get lost)