mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Merge branch 'master' into better-union-all-try2
This commit is contained in:
commit
a586fd119a
@ -1027,7 +1027,7 @@ void ExpressionAnalyzer::normalizeTreeImpl(
|
|||||||
ASTs & asts = node->children;
|
ASTs & asts = node->children;
|
||||||
for (int i = static_cast<int>(asts.size()) - 1; i >= 0; --i)
|
for (int i = static_cast<int>(asts.size()) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (ASTAsterisk * asterisk = typeid_cast<ASTAsterisk *>(asts[i].get()))
|
if (typeid_cast<ASTAsterisk *>(asts[i].get()))
|
||||||
{
|
{
|
||||||
ASTs all_columns;
|
ASTs all_columns;
|
||||||
for (const auto & column_name_type : columns)
|
for (const auto & column_name_type : columns)
|
||||||
|
@ -48,7 +48,7 @@ protected:
|
|||||||
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
|
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override
|
||||||
{
|
{
|
||||||
settings.ostr << (settings.hilite ? hilite_keyword : "")
|
settings.ostr << (settings.hilite ? hilite_keyword : "")
|
||||||
<< ASTIDAndQueryNames::Query << (settings.hilite ? hilite_none : "");
|
<< ASTIDAndQueryNames::Query << (settings.hilite ? hilite_none : "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -318,6 +318,7 @@ bool ParserCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expect
|
|||||||
{
|
{
|
||||||
/// CAST(expression AS type)
|
/// CAST(expression AS type)
|
||||||
const auto type = first_argument->tryGetAlias();
|
const auto type = first_argument->tryGetAlias();
|
||||||
|
|
||||||
if (type.empty())
|
if (type.empty())
|
||||||
{
|
{
|
||||||
/// there is only one argument and it has no alias
|
/// there is only one argument and it has no alias
|
||||||
@ -609,7 +610,7 @@ bool ParserAliasImpl<ParserIdentifier>::parseImpl(Pos & pos, ASTPtr & node, Expe
|
|||||||
ParserKeyword s_as("AS");
|
ParserKeyword s_as("AS");
|
||||||
ParserIdentifier id_p;
|
ParserIdentifier id_p;
|
||||||
|
|
||||||
bool has_as_word = s_as.parse(pos, node, expected);
|
bool has_as_word = s_as.ignore(pos, expected);
|
||||||
if (!allow_alias_without_as_keyword && !has_as_word)
|
if (!allow_alias_without_as_keyword && !has_as_word)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -746,7 +747,7 @@ bool ParserWithOptionalAliasImpl<ParserAlias>::parseImpl(Pos & pos, ASTPtr & nod
|
|||||||
ASTPtr alias_node;
|
ASTPtr alias_node;
|
||||||
if (ParserAlias(allow_alias_without_as_keyword_now).parse(pos, alias_node, expected))
|
if (ParserAlias(allow_alias_without_as_keyword_now).parse(pos, alias_node, expected))
|
||||||
{
|
{
|
||||||
String alias_name = typeid_cast<ASTIdentifier &>(*alias_node).name;
|
String alias_name = typeid_cast<const ASTIdentifier &>(*alias_node).name;
|
||||||
|
|
||||||
if (ASTWithAlias * ast_with_alias = dynamic_cast<ASTWithAlias *>(node.get()))
|
if (ASTWithAlias * ast_with_alias = dynamic_cast<ASTWithAlias *>(node.get()))
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ bool IParserBase::parse(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
node = nullptr;
|
node = nullptr;
|
||||||
pos = begin;
|
pos = begin;
|
||||||
}
|
}
|
||||||
else
|
else if (node)
|
||||||
node->range = StringRange(begin, pos);
|
node->range = StringRange(begin, pos);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -80,7 +80,7 @@ bool ParserIdentifierWithOptionalParameters::parseImpl(Pos & pos, ASTPtr & node,
|
|||||||
|
|
||||||
bool ParserTypeInCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool ParserTypeInCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||||
{
|
{
|
||||||
if (ParserIdentifierWithOptionalParameters::parseImpl(pos, node, expected))
|
if (ParserIdentifierWithOptionalParameters().parse(pos, node, expected))
|
||||||
{
|
{
|
||||||
const auto & id_with_params = typeid_cast<const ASTFunction &>(*node);
|
const auto & id_with_params = typeid_cast<const ASTFunction &>(*node);
|
||||||
node = std::make_shared<ASTIdentifier>(String{ id_with_params.range.first, id_with_params.range.second });
|
node = std::make_shared<ASTIdentifier>(String{ id_with_params.range.first, id_with_params.range.second });
|
||||||
|
@ -48,7 +48,7 @@ protected:
|
|||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParserTypeInCastExpression : public ParserIdentifierWithOptionalParameters
|
class ParserTypeInCastExpression : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "type in cast expression"; }
|
const char * getName() const { return "type in cast expression"; }
|
||||||
|
Loading…
Reference in New Issue
Block a user