|
|
@ -135,6 +135,27 @@ impl<S: EncodedQuadsStore> SimpleEvaluator<S> { |
|
|
|
iter |
|
|
|
iter |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
PlanNode::Extend { |
|
|
|
|
|
|
|
child, |
|
|
|
|
|
|
|
position, |
|
|
|
|
|
|
|
expression, |
|
|
|
|
|
|
|
} => { |
|
|
|
|
|
|
|
let eval = self.clone(); |
|
|
|
|
|
|
|
Box::new( |
|
|
|
|
|
|
|
self.eval_plan(*child, from) |
|
|
|
|
|
|
|
.filter_map(move |tuple| match tuple { |
|
|
|
|
|
|
|
Ok(mut tuple) => { |
|
|
|
|
|
|
|
put_value( |
|
|
|
|
|
|
|
position, |
|
|
|
|
|
|
|
eval.eval_expression(&expression, &tuple)?, |
|
|
|
|
|
|
|
&mut tuple, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
Some(Ok(tuple)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Err(error) => Some(Err(error)), |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
PlanNode::HashDeduplicate { child } => { |
|
|
|
PlanNode::HashDeduplicate { child } => { |
|
|
|
let iter = self.eval_plan(*child, from); |
|
|
|
let iter = self.eval_plan(*child, from); |
|
|
|
let mut values = HashSet::with_capacity(iter.size_hint().0); |
|
|
|
let mut values = HashSet::with_capacity(iter.size_hint().0); |
|
|
@ -335,16 +356,17 @@ fn get_pattern_value( |
|
|
|
fn put_pattern_value(selector: &PatternValue, value: EncodedTerm, tuple: &mut EncodedTuple) { |
|
|
|
fn put_pattern_value(selector: &PatternValue, value: EncodedTerm, tuple: &mut EncodedTuple) { |
|
|
|
match selector { |
|
|
|
match selector { |
|
|
|
PatternValue::Constant(_) => (), |
|
|
|
PatternValue::Constant(_) => (), |
|
|
|
PatternValue::Variable(v) => { |
|
|
|
PatternValue::Variable(v) => put_value(*v, value, tuple), |
|
|
|
let v = *v; |
|
|
|
} |
|
|
|
if tuple.len() > v { |
|
|
|
} |
|
|
|
tuple[v] = Some(value) |
|
|
|
|
|
|
|
} else { |
|
|
|
fn put_value(position: usize, value: EncodedTerm, tuple: &mut EncodedTuple) { |
|
|
|
if tuple.len() < v { |
|
|
|
if tuple.len() > position { |
|
|
|
tuple.resize(v, None); |
|
|
|
tuple[position] = Some(value) |
|
|
|
} |
|
|
|
} else { |
|
|
|
tuple.push(Some(value)) |
|
|
|
if tuple.len() < position { |
|
|
|
} |
|
|
|
tuple.resize(position, None); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tuple.push(Some(value)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|