Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix time() infinite loop #2820

Merged
merged 2 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'.