From 3540691648c66e84232b3658e63ea8e09385f554 Mon Sep 17 00:00:00 2001 From: Cheng Xuntao <7731943+xtcyclist@users.noreply.github.com> Date: Mon, 26 Dec 2022 16:37:11 +0800 Subject: [PATCH] revise error messages. (#5102) * revise error messages. * minor * update tck. * minor * update tck. Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> --- src/graph/executor/query/FilterExecutor.cpp | 15 ++++++++++++--- tests/tck/features/match/Base.feature | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/graph/executor/query/FilterExecutor.cpp b/src/graph/executor/query/FilterExecutor.cpp index 65d4d8382cc..6a14cace334 100644 --- a/src/graph/executor/query/FilterExecutor.cpp +++ b/src/graph/executor/query/FilterExecutor.cpp @@ -65,7 +65,10 @@ StatusOr FilterExecutor::handleJob(size_t begin, size_t end, Iterator * for (; iter->valid() && begin++ < end; iter->next()) { auto val = condition->eval(ctx(iter)); if (val.isBadNull() || (!val.empty() && !val.isImplicitBool() && !val.isNull())) { - return Status::Error("Wrong type result, the type should be NULL, EMPTY, BOOL"); + return Status::Error("Failed to evaluate condition: %s. %s%s", + condition->toString().c_str(), + "For boolean conditions, please write in their full forms like", + " == or IS [NOT] NULL."); } if (!(val.empty() || val.isNull() || (val.isImplicitBool() && !val.implicitBool()))) { // TODO: Maybe we can move. @@ -96,7 +99,10 @@ Status FilterExecutor::handleSingleJobFilter() { while (iter->valid()) { auto val = condition->eval(ctx(iter)); if (val.isBadNull() || (!val.empty() && !val.isImplicitBool() && !val.isNull())) { - return Status::Error("Wrong type result, the type should be NULL, EMPTY, BOOL"); + return Status::Error("Failed to evaluate condition: %s. %s%s", + condition->toString().c_str(), + "For boolean conditions, please write in their full forms like", + " == or IS [NOT] NULL."); } if (val.empty() || val.isNull() || (val.isImplicitBool() && !val.implicitBool())) { if (UNLIKELY(filter->needStableFilter())) { @@ -119,7 +125,10 @@ Status FilterExecutor::handleSingleJobFilter() { for (; iter->valid(); iter->next()) { auto val = condition->eval(ctx(iter)); if (val.isBadNull() || (!val.empty() && !val.isImplicitBool() && !val.isNull())) { - return Status::Error("Wrong type result, the type should be NULL, EMPTY, BOOL"); + return Status::Error("Failed to evaluate condition: %s. %s%s", + condition->toString().c_str(), + "For boolean conditions, please write in their full forms like", + " == or IS [NOT] NULL."); } if (val.isImplicitBool() && val.implicitBool()) { Row row; diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 72b1ae2f46d..63d64e57268 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -632,7 +632,7 @@ Feature: Basic match """ MATCH (v:player) where v.player.name return v """ - Then a ExecutionError should be raised at runtime: Wrong type result, the type should be NULL, EMPTY, BOOL + Then a ExecutionError should be raised at runtime: Failed to evaluate condition: v.player.name. For boolean conditions, please write in their full forms like == or IS [NOT] NULL. Scenario: Unimplemented features When executing query: