Decreases memory size of the PlanNode enum

pull/12/head
Tpt 5 years ago
parent df3702ba89
commit e5043052b7
  1. 2
      lib/src/sparql/plan.rs
  2. 7
      lib/src/sparql/plan_builder.rs

@ -22,7 +22,7 @@ pub enum PlanNode {
service_name: PatternValue, service_name: PatternValue,
variables: Vec<Variable>, variables: Vec<Variable>,
child: Box<PlanNode>, child: Box<PlanNode>,
graph_pattern: GraphPattern, graph_pattern: Box<GraphPattern>,
silent: bool, silent: bool,
}, },
QuadPatternJoin { QuadPatternJoin {

@ -104,13 +104,14 @@ impl<E: Encoder> PlanBuilder<E> {
right: Box::new(self.build_for_graph_pattern(b, variables, graph_name)?), right: Box::new(self.build_for_graph_pattern(b, variables, graph_name)?),
}, },
GraphPattern::Service(n, p, s) => { GraphPattern::Service(n, p, s) => {
// Child building should be at the begging in order for `variables` to be filled
let child = self.build_for_graph_pattern(p, variables, graph_name)?;
let service_name = self.pattern_value_from_named_node_or_variable(n, variables)?; let service_name = self.pattern_value_from_named_node_or_variable(n, variables)?;
let graph_pattern = *p.clone();
PlanNode::Service { PlanNode::Service {
service_name, service_name,
variables: variables.clone(), variables: variables.clone(),
child: Box::new(self.build_for_graph_pattern(p, variables, service_name)?), child: Box::new(child),
graph_pattern, graph_pattern: Box::new(*p.clone()),
silent: *s, silent: *s,
} }
} }

Loading…
Cancel
Save