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

Cherry pick 3.4 (0130-0131) #5306

Merged
merged 3 commits into from
Feb 2, 2023
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
4 changes: 1 addition & 3 deletions src/common/memory/MemoryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ void MemoryUtils::handleMemoryTracker(int64_t total, int64_t available) {
LOG(INFO) << "MemoryTracker disabled";
}
} else {
if (kCurrentTotal_ != limitRatio) {
LOG(ERROR) << "Invalid memory_tracker_limit_ratio: " << limitRatio;
}
LOG(ERROR) << "Invalid memory_tracker_limit_ratio: " << limitRatio;
}
kCurrentTotal_ = total;
kCurrentLimitRatio_ = limitRatio;
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def executing_query_with_retry(query, exec_ctx, request, secs, retryTimes):
break


@when(parse("executing query with user {username} with password {password}:\n{query}"))
@when(parse('executing query with user "{username}" and password "{password}":\n{query}'))
def executing_query(
username, password, conn_pool_to_first_graph_service, query, exec_ctx, request
):
Expand Down
2 changes: 2 additions & 0 deletions tests/tck/features/geo/GeoBase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Feature: Geo base
INSERT VERTEX test_3() VALUES "test_103":()
"""
Then the execution should be successful
And drop the used space

Scenario: test geo CURD
# Any geo shape(point/linestring/polygon) is allowed to insert to the column geography
Expand Down Expand Up @@ -770,3 +771,4 @@ Feature: Geo base
DROP EDGE any_shape_edge;
"""
Then the execution should be successful
And drop the used space
35 changes: 16 additions & 19 deletions tests/tck/features/lookup/ByIndex.feature
Original file line number Diff line number Diff line change
Expand Up @@ -585,23 +585,20 @@ Feature: Lookup by index itself
| name |
| "Tim Duncan" |
| "Tony Parker" |
# (TODO) Unsupported cases due to the lack of float precision
When executing query:
"""
LOOKUP ON weight WHERE weight.WEIGHT > 70.5 YIELD id(vertex) as name;
"""
Then the result should be, in any order:
| name |
| "Tony Parker" |
When executing query:
"""
LOOKUP ON weight WHERE weight.WEIGHT <= 80.0 YIELD id(vertex) as name;
"""
Then the result should be, in any order:
| name |
| "Tim Duncan" |
| "Tony Parker" |
Then drop the used space

# (TODO) Unsupported cases due to the lack of float precision
# When executing query:
# """
# LOOKUP ON weight
# WHERE weight.WEIGHT > 70.5;
# """
# Then the result should be, in any order:
# | VertexID |
# | "Tony Parker" |
# When executing query:
# """
# LOOKUP ON weight
# WHERE weight.WEIGHT <= 80.0;
# """
# Then the result should be, in any order:
# | VertexID |
# | "Tim Duncan" |
# | "Tony Parker" |
35 changes: 16 additions & 19 deletions tests/tck/features/lookup/ByIndex.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -584,23 +584,20 @@ Feature: Lookup by index itself in integer vid
| name |
| "Tim Duncan" |
| "Tony Parker" |
# (TODO) Unsupported cases due to the lack of float precision
When executing query:
"""
LOOKUP ON weight WHERE weight.WEIGHT > 70.5 YIELD id(vertex) as name;
"""
Then the result should be, in any order, and the columns 0 should be hashed:
| name |
| "Tony Parker" |
When executing query:
"""
LOOKUP ON weight WHERE weight.WEIGHT <= 80.0 YIELD id(vertex) as name;
"""
Then the result should be, in any order, and the columns 0 should be hashed:
| name |
| "Tim Duncan" |
| "Tony Parker" |
Then drop the used space

# (TODO) Unsupported cases due to the lack of float precision
# When executing query:
# """
# LOOKUP ON weight
# WHERE weight.WEIGHT > 70.5;
# """
# Then the result should be, in any order, and the columns 0 should be hashed:
# | VertexID |
# | "Tony Parker" |
# When executing query:
# """
# LOOKUP ON weight
# WHERE weight.WEIGHT <= 80.0;
# """
# Then the result should be, in any order, and the columns 0 should be hashed:
# | VertexID |
# | "Tim Duncan" |
# | "Tony Parker" |
10 changes: 10 additions & 0 deletions tests/tck/features/lookup/EdgeIndexFullScan.feature
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ Feature: Lookup edge index full scan
LOOKUP ON edge_1 WHERE edge_1.col1_str NOT STARTS WITH "R" YIELD edge_1.col1_str
"""
Then a SemanticError should be raised at runtime: Expression (edge_1.col1_str NOT STARTS WITH "R") is not supported, please use full-text index as an optimal solution
When profiling query:
"""
LOOKUP ON edge_1 WHERE NOT edge_1.col1_str STARTS WITH "R" YIELD edge_1.col1_str
"""
Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str STARTS WITH "R")) not supported yet

Scenario: Edge with relational ENDS/NOT ENDS WITH filter
When executing query:
Expand All @@ -340,3 +345,8 @@ Feature: Lookup edge index full scan
LOOKUP ON edge_1 WHERE edge_1.col1_str NOT ENDS WITH toLower("E") YIELD edge_1.col1_str
"""
Then a SemanticError should be raised at runtime: Expression (edge_1.col1_str NOT ENDS WITH toLower("E")) is not supported, please use full-text index as an optimal solution
When executing query:
"""
LOOKUP ON edge_1 WHERE NOT edge_1.col1_str ENDS WITH toLower("E") YIELD edge_1.col1_str
"""
Then a SemanticError should be raised at runtime: Expression !((edge_1.col1_str ENDS WITH toLower("E"))) not supported yet
55 changes: 54 additions & 1 deletion tests/tck/features/lookup/LookUp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,42 @@ Feature: LookUpTest_Vid_String
Then the result should be, in any order:
| id |
| "200" |
When executing query:
"""
LOOKUP ON lookup_tag_1
WHERE lookup_tag_1.col2 == 200 AND lookup_tag_1.col3 > 202
YIELD id(vertex) as id
"""
Then the result should be, in any order:
| id |
When executing query:
"""
LOOKUP ON lookup_tag_1
WHERE lookup_tag_1.col2 >= 202 OR lookup_tag_1.col1 < 201
YIELD id(vertex) as id
"""
Then the result should be, in any order:
| id |
| "200" |
| "202" |
When executing query:
"""
LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col1 == true YIELD id(vertex) as id
"""
Then the result should be, in any order:
| id |
When executing query:
"""
LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col2 == 0 YIELD id(vertex) as id
"""
Then the result should be, in any order:
| id |
When executing query:
"""
LOOKUP ON lookup_tag_2 WHERE lookup_tag_2.col3 >= 0 YIELD id(vertex) as id
"""
Then the result should be, in any order:
| id |
Then drop the used space

Scenario: LookupTest EdgeIndexHint
Expand Down Expand Up @@ -71,6 +101,23 @@ Feature: LookUpTest_Vid_String
Then the result should be, in any order:
| src | dst | rank |
| "200" | "201" | 0 |
When executing query:
"""
LOOKUP ON lookup_edge_1
WHERE lookup_edge_1.col2 == 201 AND lookup_edge_1.col3 == 200
YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank
"""
Then the result should be, in any order:
| src | dst | rank |
When executing query:
"""
LOOKUP ON lookup_edge_1
WHERE lookup_edge_1.col2 == 201 OR lookup_edge_1.col3 == 200
YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank
"""
Then the result should be, in any order:
| src | dst | rank |
| "200" | "201" | 0 |
When executing query:
"""
LOOKUP ON lookup_edge_1 WHERE lookup_edge_1.col2 IN [201] and lookup_edge_1.col2>3 YIELD src(edge) as src, dst(Edge) as dst, rank(edge) as rank
Expand All @@ -82,7 +129,13 @@ Feature: LookUpTest_Vid_String
"""
LOOKUP ON lookup_edge_2 WHERE lookup_edge_2.col1 == 200 YIELD edge as e
"""
Then a SemanticError should be raised at runtime:
Then a SemanticError should be raised at runtime: Column type error : col1
When executing query:
"""
LOOKUP ON lookup_edge_2 WHERE lookup_edge_2.col1 == false YIELD edge as e
"""
Then the result should be, in any order:
| e |
Then drop the used space

Scenario: LookupTest VertexConditionScan
Expand Down
52 changes: 52 additions & 0 deletions tests/tck/features/lookup/LookUpLimit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,55 @@ Feature: Push Limit down IndexScan Rule
| 7 | Limit | 8 | |
| 8 | EdgeIndexPrefixScan | 9 | {"limit": "3"} |
| 9 | Start | | |

Scenario: some variables in where clause of lookup statement
When executing query:
"""
$var = YIELD true;
LOOKUP ON player WHERE $var==true YIELD id(vertex) as id;
"""
Then a SemanticError should be raised at runtime: Expression ($var==true) not supported yet
When executing query:
"""
$var = YIELD true;
LOOKUP ON player WHERE player.name=='Tim Duncan' AND $var==true YIELD id(vertex) as id;
"""
Then a SemanticError should be raised at runtime: Expression ($var==true) not supported yet
When executing query:
"""
YIELD 'Tim Duncan' AS player_name |
LOOKUP ON player WHERE player.name==$-.player_name YIELD id(vertex) as id;
"""
Then a SemanticError should be raised at runtime: '$-.player_name' is not an evaluable expression
When executing query:
"""
YIELD 'Tim Duncan' AS player_name |
LOOKUP ON player WHERE player.name IN [$-.player_name, 'Tony Parker'] YIELD id(vertex) as id;
"""
Then a SemanticError should be raised at runtime: '[$-.player_name,"Tony Parker"]' is not an evaluable expression
When executing query:
"""
YIELD 'Tim Duncan' AS player_name |
LOOKUP ON player WHERE player.name==player_name YIELD id(vertex) as id;
"""
Then a SemanticError should be raised at runtime: 'player_name' is not an evaluable expression

Scenario: some variables in yield clause of lookup statement
When executing query:
"""
$var = YIELD true;
LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, $var AS v;
"""
Then a SyntaxError should be raised at runtime: Direct output of variable is prohibited near `$var'
When executing query:
"""
YIELD 'Tim Duncan' AS player_name |
LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, $-.player_name AS pn;
"""
Then a SemanticError should be raised at runtime: unsupported input/variable property expression in yield
When executing query:
"""
YIELD 'Tim Duncan' AS player_name |
LOOKUP ON player WHERE player.name=='Tim Duncan' YIELD id(vertex) as id, player_name AS pn;
"""
Then a SemanticError should be raised at runtime: Invalid label identifiers: player_name
5 changes: 3 additions & 2 deletions tests/tck/features/lookup/LookupEdge.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test lookup on edge index
Examples:
| where_condition |
Expand Down Expand Up @@ -124,5 +127,3 @@ Feature: Test lookup on edge index
| col1 | col2 | lookup_edge_1.col3 |
| 201 | 201 | 201 |
Then drop the used space

# TODO(yee): Test bool expression
3 changes: 3 additions & 0 deletions tests/tck/features/lookup/LookupEdge2.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test lookup on edge index 2
Examples:
| vid_type | id_200 | id_201 | id_202 |
Expand Down
5 changes: 3 additions & 2 deletions tests/tck/features/lookup/LookupTag.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test lookup on tag index
Examples:
| where_condition |
Expand Down Expand Up @@ -125,5 +128,3 @@ Feature: Test lookup on tag index
| lookup_tag_1.col1 | lookup_tag_1.col2 | lookup_tag_1.col3 |
| 201 | 201 | 201 |
Then drop the used space

# TODO(yee): Test bool expression
5 changes: 3 additions & 2 deletions tests/tck/features/lookup/LookupTag2.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Test lookup on tag index 2
Examples:
| vid_type | id_200 | id_201 | id_202 |
Expand Down Expand Up @@ -86,5 +89,3 @@ Feature: Test lookup on tag index 2
| 201 | 201 |
| 202 | 202 |
Then drop the used space

# TODO(yee): Test bool expression
3 changes: 3 additions & 0 deletions tests/tck/features/lookup/Output.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Lookup with output

Background:
Expand Down
13 changes: 13 additions & 0 deletions tests/tck/features/lookup/TagIndexFullScan.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Lookup tag index full scan

Background:
Expand Down Expand Up @@ -297,6 +300,11 @@ Feature: Lookup tag index full scan
| 2 | Filter | 4 | {"condition": "(team.name NOT IN [\"Hornets\",\"Jazz\"])"} |
| 4 | TagIndexFullScan | 0 | |
| 0 | Start | | |
When executing query:
"""
LOOKUP ON team WHERE NOT team.name IN ["Hornets", "Jazz"] YIELD id(vertex) as id
"""
Then a SemanticError should be raised at runtime: Expression !((team.name IN ["Hornets","Jazz"])) not supported yet
When profiling query:
"""
LOOKUP ON player WHERE player.age NOT IN [40 - 1 , 72/2] YIELD id(vertex) as id, player.age
Expand Down Expand Up @@ -373,6 +381,11 @@ Feature: Lookup tag index full scan
LOOKUP ON team WHERE team.name NOT CONTAINS "ABC" YIELD vertex as node
"""
Then a SemanticError should be raised at runtime: Expression (team.name NOT CONTAINS "ABC") is not supported, please use full-text index as an optimal solution
When executing query:
"""
LOOKUP ON team WHERE NOT team.name CONTAINS "ABC" YIELD vertex as node
"""
Then a SemanticError should be raised at runtime: Expression !((team.name CONTAINS "ABC")) not supported yet

Scenario: Tag with relational STARTS WITH filter
When profiling query:
Expand Down
14 changes: 14 additions & 0 deletions tests/tck/features/lookup/WithYield.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Lookup with yield

Background:
Expand Down Expand Up @@ -97,3 +100,14 @@ Feature: Lookup with yield
Then the result should be, in any order:
| nums |
| 6 |

Scenario: yield constant columns
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year AS startYear, 1 AS a, 10+1 AS b
"""
Then the result should be, in any order:
| startYear | a | b |
| 2008 | 1 | 11 |
| 2008 | 1 | 11 |
14 changes: 14 additions & 0 deletions tests/tck/features/lookup/WithYield.intVid.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Lookup with yield in integer vid

Background:
Expand Down Expand Up @@ -98,3 +101,14 @@ Feature: Lookup with yield in integer vid
Then the result should be, in any order:
| nums |
| 2 |

Scenario: yield constant columns
When executing query:
"""
LOOKUP ON serve WHERE serve.start_year == 2008 and serve.end_year == 2019
YIELD serve.start_year AS startYear, 1 AS a, 10+1 AS b
"""
Then the result should be, in any order:
| startYear | a | b |
| 2008 | 1 | 11 |
| 2008 | 1 | 11 |
Loading