Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Dec 29, 2021
1 parent d953c50 commit 7a6f1c4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
15 changes: 7 additions & 8 deletions src/graph/validator/test/GroupByValidatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,33 +302,32 @@ TEST_F(GroupByValidatorTest, InvalidTest) {
EXPECT_EQ(std::string(result.message()), "SemanticError: Group `SUM($-.age)' invalid");
}
{
// yield without group by
std::string query =
"GO FROM \"1\" OVER like YIELD $^.person.age AS age, "
"COUNT(like._dst) AS id ";
auto result = checkResult(query);
EXPECT_EQ(std::string(result.message()),
"SemanticError: `COUNT(like._dst) AS id' is not support in go sentence.");
"SyntaxError: Invalid use of aggregating function in yield clause. near "
"`$^.person.age AS age, COUNT(like._dst) AS id'");
}
{
// yield without group by
std::string query =
"GO FROM \"1\" OVER like YIELD $^.person.age AS age, "
"COUNT(like._dst)+1 AS id ";
auto result = checkResult(query);
EXPECT_EQ(std::string(result.message()),
"SemanticError: `(COUNT(like._dst)+1) AS id' is not support in go sentence.");
"SyntaxError: Invalid use of aggregating function in yield clause. near "
"`$^.person.age AS age, COUNT(like._dst)+1 AS id'");
}
{
// yield without group by
std::string query =
"GO FROM \"1\" OVER like WHERE count(*) + 1 >3 "
"YIELD $^.person.age AS age, "
"COUNT(like._dst)+1 AS id ";
auto result = checkResult(query);
EXPECT_EQ(std::string(result.message()),
"SemanticError: `((count(*)+1)>3)', "
"not support aggregate function in where sentence.");
EXPECT_EQ(
std::string(result.message()),
"SyntaxError: Invalid use of aggregating function in where clause. near `count(*) + 1 >3'");
}
{
// yield col not in group output
Expand Down
3 changes: 2 additions & 1 deletion src/graph/validator/test/LookupValidatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ TEST_F(LookupValidatorTest, wrongYield) {
{
std::string query = "LOOKUP ON person YIELD count(*)";
auto result = checkResult(query);
EXPECT_EQ(std::string(result.message()), "SemanticError: illegal yield clauses `count(*)'");
EXPECT_EQ(std::string(result.message()),
"SyntaxError: Invalid use of aggregating function in yield clause. near `count(*)'");
}
{
std::string query = "LOOKUP ON person YIELD vertex as node, edge";
Expand Down
6 changes: 3 additions & 3 deletions src/graph/validator/test/QueryValidatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,11 @@ TEST_F(QueryValidatorTest, GoInvalid) {
EXPECT_FALSE(checkResult(query));
}
{
// yield agg without groupBy is not supported
std::string query = "GO FROM \"2\" OVER like YIELD COUNT(123);";
auto result = checkResult(query);
EXPECT_EQ(std::string(result.message()),
"SemanticError: `COUNT(123)' is not support in go sentence.");
EXPECT_EQ(
std::string(result.message()),
"SyntaxError: Invalid use of aggregating function in yield clause. near `COUNT(123)'");
}
{
std::string query =
Expand Down
10 changes: 5 additions & 5 deletions tests/tck/features/aggregate/Agg.feature
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ Feature: Basic Aggregate and GroupBy
"""
GO FROM "Tim Duncan" OVER like where COUNT(*) > 2 YIELD like._dst
"""
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in yield clause. near `count(*) > 2'
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in where clause. near `COUNT(*) > 2'
When executing query:
"""
GO FROM "Marco Belinelli" OVER serve
Expand Down Expand Up @@ -767,30 +767,30 @@ Feature: Basic Aggregate and GroupBy
YIELD $$.team.name AS name,
COUNT(serve._dst) AS id
"""
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in yield clause. near `COUNT(serve._dst) AS id'
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in yield clause. near `$$.team.name AS name, COUNT(serve._dst) AS id'
When executing query:
"""
MATCH (v:player)
WHERE avg(v.player.age) > 1
RETURN v.player.age
"""
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1'
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in where clause. near `avg(v.player.age) > 1'
When executing query:
"""
MATCH (v:player)
WITH v
WHERE avg(v.player.age) > 1
RETURN v.player.age
"""
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1'
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in where clause. near `avg(v.player.age) > 1'
When executing query:
"""
MATCH (v:player)
WITH DISTINCT v
WHERE avg(v.player.age) > 1
RETURN v.player.age
"""
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in this context. near `WHERE avg(v.player.age) > 1'
Then a SyntaxError should be raised at runtime: Invalid use of aggregating function in where clause. near `avg(v.player.age) > 1'
# When executing query:
# """
Expand Down

0 comments on commit 7a6f1c4

Please sign in to comment.