Skip to content

Commit

Permalink
fix time() infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
czpmango committed Sep 8, 2021
1 parent e204786 commit fa51d4e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/graph/visitor/DeduceTypeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static const std::unordered_map<Value::Type, Value> kConstantValues = {
{Value::Type::STRING, Value("123")},
{Value::Type::DATE, Value(Date())},
{Value::Type::DATETIME, Value(DateTime())},
{Value::Type::TIME, Value(Time())},
{Value::Type::VERTEX, Value(Vertex())},
{Value::Type::EDGE, Value(Edge())},
{Value::Type::PATH, Value(Path())},
Expand Down
17 changes: 17 additions & 0 deletions tests/tck/features/expression/FunctionCall.feature
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,20 @@ Feature: Function Call Expression
Then the result should be, in any order:
| result |
| NULL |

Scenario: error check
When executing query:
"""
RETURN timestamp("2000-10-10T10:00:00") + true
"""
Then a SemanticError should be raised at runtime: `(timestamp("2000-10-10T10:00:00")+true)' is not a valid expression, can not apply `+' to `INT' and `BOOL'.
When executing query:
"""
RETURN time("10:00:00") + 3
"""
Then a SemanticError should be raised at runtime: `(time("10:00:00")+3)' is not a valid expression, can not apply `+' to `TIME' and `INT'.
When executing query:
"""
RETURN datetime("2000-10-10T10:00:00") + 3
"""
Then a SemanticError should be raised at runtime: `(datetime("2000-10-10T10:00:00")+3)' is not a valid expression, can not apply `+' to `DATETIME' and `INT'.

0 comments on commit fa51d4e

Please sign in to comment.