Fix style errors

This commit is contained in:
potya 2020-05-27 15:22:12 +03:00
parent 1fbcdbb58a
commit d5840688a1
4 changed files with 16 additions and 16 deletions

View File

@ -298,13 +298,14 @@ ColumnsDescription InterpreterCreateQuery::getColumnsDescription(const ASTExpres
if (col_decl.is_not && col_decl.is_null) { if (col_decl.is_not && col_decl.is_null) {
if (column_type->isNullable()) if (column_type->isNullable())
throw Exception{"Cant use NOT NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE}; throw Exception{"Cant use NOT NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE};
} else if (col_decl.is_null && !col_decl.is_not) { }
else if (col_decl.is_null && !col_decl.is_not)
{
if (column_type->isNullable()) if (column_type->isNullable())
throw Exception{"Cant use NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE}; throw Exception{"Cant use NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE};
else { else
column_type = makeNullable(column_type); column_type = makeNullable(column_type);
} }
}
if (context.getSettingsRef().data_type_default_nullable && !column_type->isNullable() && !col_decl.is_not && !col_decl.is_null) if (context.getSettingsRef().data_type_default_nullable && !column_type->isNullable() && !col_decl.is_not && !col_decl.is_null)
column_type = makeNullable(column_type); column_type = makeNullable(column_type);

View File

@ -83,8 +83,6 @@ void ASTColumnDeclaration::formatImpl(const FormatSettings & settings, FormatSta
is_null->formatImpl(settings, state, frame); is_null->formatImpl(settings, state, frame);
} }
if (default_expression) if (default_expression)
{ {
settings.ostr << ' ' << (settings.hilite ? hilite_keyword : "") << default_specifier << (settings.hilite ? hilite_none : "") << ' '; settings.ostr << ' ' << (settings.hilite ? hilite_keyword : "") << default_specifier << (settings.hilite ? hilite_none : "") << ' ';

View File

@ -171,18 +171,17 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
// Pos pos_before_null = pos; // Pos pos_before_null = pos;
if (s_not.check(pos, expected)) { if (s_not.check(pos, expected))
if (s_null.check(pos, expected)) { if (s_null.check(pos, expected))
{
is_not = std::make_shared<ASTIdentifier>("NOT"); is_not = std::make_shared<ASTIdentifier>("NOT");
is_null = std::make_shared<ASTIdentifier>("NULL"); is_null = std::make_shared<ASTIdentifier>("NULL");
} else { }
else
return false; return false;
} else
} else { if (s_null.check(pos, expected))
if (s_null.check(pos, expected)) {
is_null = std::make_shared<ASTIdentifier>("NULL"); is_null = std::make_shared<ASTIdentifier>("NULL");
}
}
if (s_comment.ignore(pos, expected)) if (s_comment.ignore(pos, expected))
{ {
@ -213,12 +212,14 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
column_declaration->children.push_back(std::move(type)); column_declaration->children.push_back(std::move(type));
} }
if (is_null) { if (is_null)
{
column_declaration->is_null = is_null; column_declaration->is_null = is_null;
column_declaration->children.push_back(std::move(is_null)); column_declaration->children.push_back(std::move(is_null));
} }
if (is_not) { if (is_not)
{
column_declaration->is_not = is_not; column_declaration->is_not = is_not;
column_declaration->children.push_back(std::move(is_not)); column_declaration->children.push_back(std::move(is_not));
} }