Skip to content

Commit

Permalink
Merge branch 'master' into distinct-transfer-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
swilly22 committed Feb 27, 2022
2 parents edb30e8 + c6d9f18 commit 1100df0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ramp.yml
Expand Up @@ -5,7 +5,7 @@ description: A graph database module for Redis
homepage: http://redisgraph.io
license: Redis Source Available License Agreement
command_line_args: ""
min_redis_version: "6.2"
min_redis_version: "6.0"
min_redis_pack_version: "6.2.8"
config_command: "GRAPH.CONFIG SET"
capabilities:
Expand Down
Expand Up @@ -268,7 +268,7 @@ OpBase *ExecutionPlan_LocateReferences
rax *refs_to_resolve
) {
return ExecutionPlan_LocateReferencesExcludingOps(
root, recurse_limit, NULL, 0, refs_to_resolve);
root, recurse_limit, NULL, 0, refs_to_resolve);
}

void _ExecutionPlan_LocateTaps
Expand Down Expand Up @@ -368,7 +368,8 @@ OpBase *ExecutionPlan_BuildOpsFromPath(ExecutionPlan *plan, const char **bound_v
match_stream_plan->record_map = plan->record_map;

// If we have bound variables, build an Argument op that represents them.
if(bound_vars) match_stream_plan->root = NewArgumentOp(plan, bound_vars);
if(bound_vars) match_stream_plan->root = NewArgumentOp(match_stream_plan,
bound_vars);

AST *ast = QueryCtx_GetAST();
// Build a temporary AST holding a MATCH clause.
Expand Down
20 changes: 18 additions & 2 deletions tests/flow/test_optional_match.py
@@ -1,5 +1,4 @@
import os
import sys
import re
from RLTest import Env
from redisgraph import Graph, Node, Edge
from base import FlowTestsBase
Expand Down Expand Up @@ -275,3 +274,20 @@ def test21_optional_filters_without_references(self):
actual_result = redis_graph.query(query)
expected_result = [['v1', 'v2']]
self.env.assertEquals(actual_result.result_set, expected_result)

# validate that the correct plan is populated and executed when OPTIONAL
# does not introduce any new variables
def test22_optional_repeats_reference(self):
global redis_graph
query = """MATCH (n1) OPTIONAL MATCH (n1) WHERE n1.nonexistent > 0 RETURN n1.v ORDER BY n1.v"""
plan = redis_graph.execution_plan(query)
# the first child of the Apply op should be a scan and the
# second should be the OPTIONAL subtree
self.env.assertTrue(re.search('Apply\s+All Node Scan | (n1)\s+Optional\s+Filter\s+Argument', plan))

actual_result = redis_graph.query(query)
expected_result = [['v1'],
['v2'],
['v3'],
['v4']]
self.env.assertEquals(actual_result.result_set, expected_result)

0 comments on commit 1100df0

Please sign in to comment.