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

revise error messages. #5102

Merged
merged 6 commits into from
Dec 26, 2022
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
15 changes: 12 additions & 3 deletions src/graph/executor/query/FilterExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ StatusOr<DataSet> 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",
" <condition> == <true/false> or <condition> IS [NOT] NULL.");
}
if (!(val.empty() || val.isNull() || (val.isImplicitBool() && !val.implicitBool()))) {
// TODO: Maybe we can move.
Expand Down Expand Up @@ -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",
" <condition> == <true/false> or <condition> IS [NOT] NULL.");
}
if (val.empty() || val.isNull() || (val.isImplicitBool() && !val.implicitBool())) {
if (UNLIKELY(filter->needStableFilter())) {
Expand All @@ -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",
" <condition> == <true/false> or <condition> IS [NOT] NULL.");
}
if (val.isImplicitBool() && val.implicitBool()) {
Row row;
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/match/Base.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 <condition> == <true/false> or <condition> IS [NOT] NULL.

Scenario: Unimplemented features
When executing query:
Expand Down