Sanity check that the SelectAST isn't corrupt

This commit is contained in:
Robert Schulze 2023-01-02 12:06:18 +00:00
parent 05b70b0cb6
commit 4c03ccf99b
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A

View File

@ -113,8 +113,10 @@ void ASTSelectQuery::formatImpl(const FormatSettings & s, FormatState & state, F
if (group_by_with_cube)
s.ostr << (s.hilite ? hilite_keyword : "") << s.nl_or_ws << indent_str << (s.one_line ? "" : " ") << "WITH CUBE" << (s.hilite ? hilite_none : "");
if (groupBy() && group_by_with_grouping_sets)
if (group_by_with_grouping_sets)
{
if (!groupBy()) /// sanity check, issue 43049
throw Exception(ErrorCodes::LOGICAL_ERROR, "Corrupt AST");
auto nested_frame = frame;
nested_frame.surround_each_list_element_with_parens = true;
nested_frame.expression_list_prepend_whitespace = false;