mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
add test
fix fix
This commit is contained in:
parent
eb8d8f6ba4
commit
7b69592e49
@ -670,14 +670,14 @@ bool ParserIntervalOperatorExpression::parseImpl(Pos & pos, ASTPtr & node, Expec
|
|||||||
IntervalKind interval_kind;
|
IntervalKind interval_kind;
|
||||||
ASTPtr number;
|
ASTPtr number;
|
||||||
|
|
||||||
|
/// parse function arguments and interval kind from string literal
|
||||||
if (!stringToIntervalKind(literal, number, interval_kind))
|
if (!stringToIntervalKind(literal, number, interval_kind))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto function = std::make_shared<ASTFunction>();
|
auto function = std::make_shared<ASTFunction>();
|
||||||
|
|
||||||
/// function arguments
|
|
||||||
auto exp_list = std::make_shared<ASTExpressionList>();
|
auto exp_list = std::make_shared<ASTExpressionList>();
|
||||||
|
|
||||||
/// the first argument of the function is the previous element, the second is the next one
|
|
||||||
function->name = interval_kind.toNameOfFunctionToIntervalDataType();
|
function->name = interval_kind.toNameOfFunctionToIntervalDataType();
|
||||||
function->arguments = exp_list;
|
function->arguments = exp_list;
|
||||||
function->children.push_back(exp_list);
|
function->children.push_back(exp_list);
|
||||||
@ -690,12 +690,11 @@ bool ParserIntervalOperatorExpression::parseImpl(Pos & pos, ASTPtr & node, Expec
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASTPtr expr;
|
ASTPtr expr;
|
||||||
|
|
||||||
/// Any expression can be inside, because operator surrounds it.
|
/// Any expression can be inside, because operator surrounds it.
|
||||||
if (!ParserExpressionWithOptionalAlias(false).parse(pos, expr, expected))
|
if (!ParserExpressionWithOptionalAlias(false).parse(pos, expr, expected))
|
||||||
{
|
{
|
||||||
pos = begin;
|
pos = begin;
|
||||||
return next_parser.parse(pos, node, expected);
|
return next_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntervalKind interval_kind;
|
IntervalKind interval_kind;
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
2
|
||||||
|
2
|
||||||
|
2
|
||||||
|
2
|
||||||
|
2
|
||||||
|
2
|
@ -0,0 +1,6 @@
|
|||||||
|
SELECT INTERVAL 2 day;
|
||||||
|
SELECT INTERVAL '2 day';
|
||||||
|
SELECT INTERVAL 2 hour;
|
||||||
|
SELECT INTERVAL '2 hour';
|
||||||
|
SELECT INTERVAL 2 minute;
|
||||||
|
SELECT INTERVAL '2 minute';
|
Loading…
Reference in New Issue
Block a user