From e922d3293b804ac6837db469f71dba1289894a30 Mon Sep 17 00:00:00 2001 From: Tpt Date: Tue, 8 Nov 2022 12:25:23 +0100 Subject: [PATCH] Fixes LATERAL inside of OPTIONAL behavior --- lib/src/sparql/plan_builder.rs | 5 ++--- .../sparql/lateral/subselect_inside_optional.srx | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/src/sparql/plan_builder.rs b/lib/src/sparql/plan_builder.rs index d223f213..401c2be2 100644 --- a/lib/src/sparql/plan_builder.rs +++ b/lib/src/sparql/plan_builder.rs @@ -1128,9 +1128,8 @@ impl<'a> PlanBuilder<'a> { } => { let mut child_problematic_set = BTreeSet::new(); for (child_i, output_i) in lateral_mapping.iter() { - if set.contains(output_i) { - child_problematic_set.insert(*child_i); - } + set.insert(*output_i); + child_problematic_set.insert(*child_i); } Self::add_left_join_problematic_variables(child, &mut child_problematic_set); for (child_i, output_i) in mapping.iter() { diff --git a/testsuite/oxigraph-tests/sparql/lateral/subselect_inside_optional.srx b/testsuite/oxigraph-tests/sparql/lateral/subselect_inside_optional.srx index 11630eb9..ce409249 100644 --- a/testsuite/oxigraph-tests/sparql/lateral/subselect_inside_optional.srx +++ b/testsuite/oxigraph-tests/sparql/lateral/subselect_inside_optional.srx @@ -26,7 +26,7 @@ http://example.org/s2 - 21 + 11 @@ -34,13 +34,24 @@ http://example.org/s2 - 22 + 11 http://example.org/s3 + + 11 + + + + + http://example.org/s3 + + + 11 + \ No newline at end of file