Fixes LATERAL inside of OPTIONAL behavior

lateral
Tpt 2 years ago
parent 2d7eac932f
commit e922d3293b
  1. 5
      lib/src/sparql/plan_builder.rs
  2. 15
      testsuite/oxigraph-tests/sparql/lateral/subselect_inside_optional.srx

@ -1128,9 +1128,8 @@ impl<'a> PlanBuilder<'a> {
} => { } => {
let mut child_problematic_set = BTreeSet::new(); let mut child_problematic_set = BTreeSet::new();
for (child_i, output_i) in lateral_mapping.iter() { for (child_i, output_i) in lateral_mapping.iter() {
if set.contains(output_i) { set.insert(*output_i);
child_problematic_set.insert(*child_i); child_problematic_set.insert(*child_i);
}
} }
Self::add_left_join_problematic_variables(child, &mut child_problematic_set); Self::add_left_join_problematic_variables(child, &mut child_problematic_set);
for (child_i, output_i) in mapping.iter() { for (child_i, output_i) in mapping.iter() {

@ -26,7 +26,7 @@
<uri>http://example.org/s2</uri> <uri>http://example.org/s2</uri>
</binding> </binding>
<binding name="o"> <binding name="o">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">21</literal> <literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal>
</binding> </binding>
</result> </result>
<result> <result>
@ -34,13 +34,24 @@
<uri>http://example.org/s2</uri> <uri>http://example.org/s2</uri>
</binding> </binding>
<binding name="o"> <binding name="o">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">22</literal> <literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal>
</binding> </binding>
</result> </result>
<result> <result>
<binding name="s"> <binding name="s">
<uri>http://example.org/s3</uri> <uri>http://example.org/s3</uri>
</binding> </binding>
<binding name="o">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/s3</uri>
</binding>
<binding name="o">
<literal datatype="http://www.w3.org/2001/XMLSchema#integer">11</literal>
</binding>
</result> </result>
</results> </results>
</sparql> </sparql>
Loading…
Cancel
Save