Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210360228
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210360228
Commits
4f841029
Unverified
Commit
4f841029
authored
4 years ago
by
kyle.cao
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix filter bug (#446)
* fix filter bug * Add test_multi_edges_with_filter * modify error message * fix test
parent
452335d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/executor/query/FilterExecutor.cpp
+3
-3
3 additions, 3 deletions
src/executor/query/FilterExecutor.cpp
tests/query/v1/test_go.py
+58
-0
58 additions, 0 deletions
tests/query/v1/test_go.py
with
61 additions
and
3 deletions
src/executor/query/FilterExecutor.cpp
+
3
−
3
View file @
4f841029
...
...
@@ -33,11 +33,11 @@ folly::Future<Status> FilterExecutor::execute() {
auto
condition
=
filter
->
condition
();
while
(
iter
->
valid
())
{
auto
val
=
condition
->
eval
(
ctx
(
iter
.
get
()));
if
(
!
val
.
isBool
()
&&
!
val
.
isNull
())
{
if
(
!
val
.
empty
()
&&
!
val
.
isBool
()
&&
!
val
.
isNull
())
{
return
Status
::
Error
(
"Internal Error: Wrong type result, "
"should be NULL
type
or BOOL
type
"
);
"
the type
should be NULL
,EMPTY
or BOOL"
);
}
if
(
val
.
isNull
()
||
!
val
.
getBool
())
{
if
(
val
.
empty
()
||
val
.
isNull
()
||
!
val
.
getBool
())
{
iter
->
erase
();
}
else
{
iter
->
next
();
...
...
This diff is collapsed.
Click to expand it.
tests/query/v1/test_go.py
+
58
−
0
View file @
4f841029
...
...
@@ -566,6 +566,64 @@ class TestGoQuery(NebulaTestSuite):
}
self
.
check_out_of_order_result
(
resp
,
expected_data
[
"
rows
"
])
def
test_multi_edges_with_filter
(
self
):
stmt
=
'''
GO FROM
"
Russell Westbrook
"
OVER serve, like WHERE serve.start_year > 2000
\
YIELD serve.start_year, like.likeness
'''
resp
=
self
.
execute
(
stmt
)
self
.
check_resp_succeeded
(
resp
)
expected_data
=
{
"
column_names
"
:
[],
"
rows
"
:
[
[
2008
,
T_EMPTY
]
]
}
self
.
check_out_of_order_result
(
resp
,
expected_data
[
"
rows
"
])
stmt
=
'''
GO FROM
"
Manu Ginobili
"
OVER like, teammate REVERSELY WHERE like.likeness > 90 YIELD like.likeness,
\
teammate.start_year, $$.player.name
'''
resp
=
self
.
execute
(
stmt
)
self
.
check_resp_succeeded
(
resp
)
expected_data
=
{
"
column_names
"
:
[],
"
rows
"
:
[
[
95
,
T_EMPTY
,
"
Tim Duncan
"
],
[
95
,
T_EMPTY
,
"
Tony Parker
"
],
[
99
,
T_EMPTY
,
"
Dejounte Murray
"
]
]
}
self
.
check_out_of_order_result
(
resp
,
expected_data
[
"
rows
"
])
stmt
=
'''
GO FROM
"
Manu Ginobili
"
OVER *
\
WHERE $$.player.age > 30 or $$.team.name not starts with
"
Rockets
"
\
YIELD DISTINCT $$.player.age, $$.player.name, $$.team.name
'''
resp
=
self
.
execute
(
stmt
)
self
.
check_resp_succeeded
(
resp
)
expected_data
=
{
"
column_names
"
:
[],
"
rows
"
:
[
[
T_EMPTY
,
T_EMPTY
,
"
Spurs
"
],
[
42
,
"
Tim Duncan
"
,
T_EMPTY
],
[
36
,
"
Tony Parker
"
,
T_EMPTY
]
]
}
self
.
check_out_of_order_result
(
resp
,
expected_data
[
"
rows
"
])
stmt
=
'''
GO FROM
"
Manu Ginobili
"
OVER like, teammate REVERSELY
\
WHERE $$.player.age > 30 and $$.player.age < 40
\
YIELD DISTINCT $$.player.age, $$.player.name
'''
resp
=
self
.
execute
(
stmt
)
self
.
check_resp_succeeded
(
resp
)
expected_data
=
{
"
column_names
"
:
[],
"
rows
"
:
[
[
34
,
"
Tiago Splitter
"
],
[
36
,
"
Tony Parker
"
]
]
}
self
.
check_out_of_order_result
(
resp
,
expected_data
[
"
rows
"
])
def
test_reference_pipe_in_yieldandwhere
(
self
):
stmt
=
'''
GO FROM
'
Tim Duncan
'
,
'
Chris Paul
'
OVER like
\
YIELD $^.player.name AS name, like._dst AS id
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment