|
|
@ -285,7 +285,7 @@ impl<'a, S: StoreConnection + 'a> SimpleEvaluator<S> { |
|
|
|
eval: self, |
|
|
|
eval: self, |
|
|
|
right_plan: &*right, |
|
|
|
right_plan: &*right, |
|
|
|
left_iter: self.eval_plan(&*left, filtered_from), |
|
|
|
left_iter: self.eval_plan(&*left, filtered_from), |
|
|
|
current_right: Vec::default(), |
|
|
|
current_right: Box::new(empty()), |
|
|
|
}; |
|
|
|
}; |
|
|
|
if problem_vars.is_empty() { |
|
|
|
if problem_vars.is_empty() { |
|
|
|
Box::new(iter) |
|
|
|
Box::new(iter) |
|
|
@ -2015,24 +2015,20 @@ struct LeftJoinIterator<'a, S: StoreConnection + 'a> { |
|
|
|
eval: &'a SimpleEvaluator<S>, |
|
|
|
eval: &'a SimpleEvaluator<S>, |
|
|
|
right_plan: &'a PlanNode, |
|
|
|
right_plan: &'a PlanNode, |
|
|
|
left_iter: EncodedTuplesIterator<'a>, |
|
|
|
left_iter: EncodedTuplesIterator<'a>, |
|
|
|
current_right: Vec<Result<EncodedTuple>>, //TODO: keep using an iterator?
|
|
|
|
current_right: EncodedTuplesIterator<'a>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl<'a, S: StoreConnection> Iterator for LeftJoinIterator<'a, S> { |
|
|
|
impl<'a, S: StoreConnection> Iterator for LeftJoinIterator<'a, S> { |
|
|
|
type Item = Result<EncodedTuple>; |
|
|
|
type Item = Result<EncodedTuple>; |
|
|
|
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Result<EncodedTuple>> { |
|
|
|
fn next(&mut self) -> Option<Result<EncodedTuple>> { |
|
|
|
if let Some(tuple) = self.current_right.pop() { |
|
|
|
if let Some(tuple) = self.current_right.next() { |
|
|
|
return Some(tuple); |
|
|
|
return Some(tuple); |
|
|
|
} |
|
|
|
} |
|
|
|
match self.left_iter.next()? { |
|
|
|
match self.left_iter.next()? { |
|
|
|
Ok(left_tuple) => { |
|
|
|
Ok(left_tuple) => { |
|
|
|
let mut current_right: Vec<_> = self |
|
|
|
self.current_right = self.eval.eval_plan(self.right_plan, left_tuple.clone()); |
|
|
|
.eval |
|
|
|
if let Some(right_tuple) = self.current_right.next() { |
|
|
|
.eval_plan(self.right_plan, left_tuple.clone()) |
|
|
|
|
|
|
|
.collect(); |
|
|
|
|
|
|
|
if let Some(right_tuple) = current_right.pop() { |
|
|
|
|
|
|
|
self.current_right = current_right; |
|
|
|
|
|
|
|
Some(right_tuple) |
|
|
|
Some(right_tuple) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Some(Ok(left_tuple)) |
|
|
|
Some(Ok(left_tuple)) |
|
|
|