fix

fix
This commit is contained in:
feng lv 2020-10-14 23:08:47 +08:00
parent eb8d8f6ba4
commit 7b69592e49
3 changed files with 16 additions and 5 deletions

View File

@ -670,14 +670,14 @@ bool ParserIntervalOperatorExpression::parseImpl(Pos & pos, ASTPtr & node, Expec
IntervalKind interval_kind;
ASTPtr number;
/// parse function arguments and interval kind from string literal
if (!stringToIntervalKind(literal, number, interval_kind))
return false;
auto function = std::make_shared<ASTFunction>();
/// function arguments
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->arguments = exp_list;
function->children.push_back(exp_list);
@ -690,7 +690,6 @@ bool ParserIntervalOperatorExpression::parseImpl(Pos & pos, ASTPtr & node, Expec
}
ASTPtr expr;
/// Any expression can be inside, because operator surrounds it.
if (!ParserExpressionWithOptionalAlias(false).parse(pos, expr, expected))
{

View File

@ -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';