Fixes variables scoping for EXISTS

Do not expose them outside in case they are reused
pull/171/head
Tpt 3 years ago
parent 6f1fc51767
commit a653506f4c
  1. 11
      lib/src/sparql/plan_builder.rs

@ -737,9 +737,14 @@ impl<'a> PlanBuilder<'a> {
Box::new(self.build_for_expression(b, variables, graph_name)?), Box::new(self.build_for_expression(b, variables, graph_name)?),
Box::new(self.build_for_expression(c, variables, graph_name)?), Box::new(self.build_for_expression(c, variables, graph_name)?),
), ),
Expression::Exists(n) => PlanExpression::Exists(Rc::new( Expression::Exists(n) => {
self.build_for_graph_pattern(n, variables, graph_name)?, let mut variables = variables.clone(); // Do not expose the exists variables outside
)), PlanExpression::Exists(Rc::new(self.build_for_graph_pattern(
n,
&mut variables,
graph_name,
)?))
}
Expression::Coalesce(parameters) => { Expression::Coalesce(parameters) => {
PlanExpression::Coalesce(self.expression_list(parameters, variables, graph_name)?) PlanExpression::Coalesce(self.expression_list(parameters, variables, graph_name)?)
} }

Loading…
Cancel
Save