diff --git a/src/graph/visitor/DeduceTypeVisitor.cpp b/src/graph/visitor/DeduceTypeVisitor.cpp index 73f947d266a..16fccff4e78 100644 --- a/src/graph/visitor/DeduceTypeVisitor.cpp +++ b/src/graph/visitor/DeduceTypeVisitor.cpp @@ -105,8 +105,19 @@ static const std::unordered_map kConstantValues = { auto detectValue = prevOp->second OP currentOp->second; \ if (detectValue.isBadNull()) { \ std::stringstream ss; \ - ss << "`" << expr->toString() << "' is not a valid expression, " \ - << "can not apply `" << #OP << "' to `" << prev << "' and `" << current << "'."; \ + if (strcmp(#OP, "&&") == 0 || strcmp(#OP, "AND") == 0) { \ + ss << "`" << expr->toString() << "' is not a valid expression, " \ + << "can not apply `&&' or `AND' operator to `" << prev << "' and `" << current \ + << "'."; \ + } else if (strcmp(#OP, "||") == 0 || strcmp(#OP, "OR") == 0) { \ + ss << "`" << expr->toString() << "' is not a valid expression, " \ + << "can not apply `||' or `OR' operator to `" << prev << "' and `" << current \ + << "'."; \ + } else { \ + ss << "`" << expr->toString() << "' is not a valid expression, " \ + << "can not apply `" << #OP << "' operator to `" << prev << "' and `" << current \ + << "'."; \ + } \ status_ = Status::SemanticError(ss.str()); \ return; \ } \ diff --git a/tests/tck/features/yield/yield.feature b/tests/tck/features/yield/yield.feature index 9eb6d8c962b..71afde05e15 100644 --- a/tests/tck/features/yield/yield.feature +++ b/tests/tck/features/yield/yield.feature @@ -554,3 +554,10 @@ Feature: Yield Sentence Then the result should be, in any order, with relax comparison: | counT(*) | aVg(3) | bit_Or(1) | | 1 | 3.0 | 1 | + + Scenario: Error message for and/or + When executing query: + """ + YIELD -1 AND TRUE; + """ + Then a SemanticError should be raised at runtime: `(-(1) AND true)' is not a valid expression, can not apply `&&' or `AND' operator to `INT' and `BOOL'.