Add fix indexed join crash (#1478)
This commit is contained in:
parent
38ad5e2146
commit
0756cd6898
@ -146,8 +146,11 @@ class JoinRewriter final : public HierarchicalLogicalOperatorVisitor {
|
||||
|
||||
bool PreVisit(IndexedJoin &op) override {
|
||||
prev_ops_.push_back(&op);
|
||||
return true;
|
||||
RewriteBranch(&op.main_branch_);
|
||||
RewriteBranch(&op.sub_branch_);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PostVisit(IndexedJoin &) override {
|
||||
prev_ops_.pop_back();
|
||||
return true;
|
||||
|
@ -70,6 +70,7 @@ add_subdirectory(index_hints)
|
||||
add_subdirectory(query_modules)
|
||||
add_subdirectory(constraints)
|
||||
add_subdirectory(inspect_query)
|
||||
add_subdirectory(queries)
|
||||
|
||||
copy_e2e_python_files(pytest_runner pytest_runner.sh "")
|
||||
copy_e2e_python_files(x x.sh "")
|
||||
|
6
tests/e2e/queries/CMakeLists.txt
Normal file
6
tests/e2e/queries/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
function(copy_queries_e2e_python_files FILE_NAME)
|
||||
copy_e2e_python_files(queries ${FILE_NAME})
|
||||
endfunction()
|
||||
|
||||
copy_queries_e2e_python_files(common.py)
|
||||
copy_queries_e2e_python_files(queries.py)
|
24
tests/e2e/queries/common.py
Normal file
24
tests/e2e/queries/common.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright 2023 Memgraph Ltd.
|
||||
#
|
||||
# Use of this software is governed by the Business Source License
|
||||
# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
# License, and you may not use this file except in compliance with the Business Source License.
|
||||
#
|
||||
# As of the Change Date specified in that file, in accordance with
|
||||
# the Business Source License, use of this software will be governed
|
||||
# by the Apache License, Version 2.0, included in the file
|
||||
# licenses/APL.txt.
|
||||
|
||||
import pytest
|
||||
from gqlalchemy import Memgraph
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def memgraph(**kwargs) -> Memgraph:
|
||||
memgraph = Memgraph()
|
||||
|
||||
yield memgraph
|
||||
|
||||
memgraph.drop_indexes()
|
||||
memgraph.ensure_constraints([])
|
||||
memgraph.drop_database()
|
39
tests/e2e/queries/queries.py
Normal file
39
tests/e2e/queries/queries.py
Normal file
@ -0,0 +1,39 @@
|
||||
# Copyright 2023 Memgraph Ltd.
|
||||
#
|
||||
# Use of this software is governed by the Business Source License
|
||||
# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
# License, and you may not use this file except in compliance with the Business Source License.
|
||||
#
|
||||
# As of the Change Date specified in that file, in accordance with
|
||||
# the Business Source License, use of this software will be governed
|
||||
# by the Apache License, Version 2.0, included in the file
|
||||
# licenses/APL.txt.
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from common import memgraph
|
||||
|
||||
|
||||
def test_indexed_join_with_indices(memgraph):
|
||||
memgraph.execute(
|
||||
"CREATE (c:A {prop: 1})-[b:TYPE]->(p:A {prop: 1}) CREATE (cf:B:A {prop : 1}) CREATE (pf:B:A {prop : 1});"
|
||||
)
|
||||
memgraph.execute("CREATE INDEX ON :A;")
|
||||
memgraph.execute("CREATE INDEX ON :B;")
|
||||
memgraph.execute("CREATE INDEX ON :A(prop);")
|
||||
memgraph.execute("CREATE INDEX ON :B(prop);")
|
||||
|
||||
results = list(
|
||||
memgraph.execute_and_fetch(
|
||||
"match (c:A)-[b:TYPE]->(p:A) match (cf:B:A {prop : c.prop}) match (pf:B:A {prop : p.prop}) return c;"
|
||||
)
|
||||
)
|
||||
|
||||
assert len(results) == 4
|
||||
for res in results:
|
||||
assert res["c"].prop == 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(pytest.main([__file__, "-rA"]))
|
14
tests/e2e/queries/workloads.yaml
Normal file
14
tests/e2e/queries/workloads.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
queries_cluster: &queries_cluster
|
||||
cluster:
|
||||
main:
|
||||
args: ["--bolt-port", "7687", "--log-level=TRACE"]
|
||||
log_file: "queries.log"
|
||||
setup_queries: []
|
||||
validation_queries: []
|
||||
|
||||
|
||||
workloads:
|
||||
- name: "Queries validation"
|
||||
binary: "tests/e2e/pytest_runner.sh"
|
||||
args: ["queries/queries.py"]
|
||||
<<: *queries_cluster
|
Loading…
Reference in New Issue
Block a user