|
|
@ -299,17 +299,16 @@ impl<'a> WalkOp<'a> {
|
|
|
|
fn build_selection_iter(
|
|
|
|
fn build_selection_iter(
|
|
|
|
&self,
|
|
|
|
&self,
|
|
|
|
it: Box<dyn Iterator<Item = Result<TupleSet>>>,
|
|
|
|
it: Box<dyn Iterator<Item = Result<TupleSet>>>,
|
|
|
|
|
|
|
|
truncate_kv_sizes: (usize, usize),
|
|
|
|
) -> Result<impl Iterator<Item = Result<TupleSet>>> {
|
|
|
|
) -> Result<impl Iterator<Item = Result<TupleSet>>> {
|
|
|
|
let extraction_vec = self.extraction_map.values().cloned().collect::<Vec<_>>();
|
|
|
|
let extraction_vec = self.extraction_map.values().cloned().collect::<Vec<_>>();
|
|
|
|
|
|
|
|
|
|
|
|
extraction_vec.iter().for_each(|ex| ex.aggr_reset());
|
|
|
|
extraction_vec.iter().for_each(|ex| ex.aggr_reset());
|
|
|
|
let mut val_collectors = vec![];
|
|
|
|
let mut val_collectors = vec![];
|
|
|
|
for ex in &extraction_vec {
|
|
|
|
for ex in &extraction_vec {
|
|
|
|
// TODO the check here is more complicated than in the group case:
|
|
|
|
if !ex.is_truncate_aggr_compatible(truncate_kv_sizes.0, truncate_kv_sizes.1) {
|
|
|
|
// check that nothing non-aggr exceeds the allowed kv range
|
|
|
|
return Err(AlgebraParseError::ScalarFnNotAllowed.into());
|
|
|
|
// if !ex.is_aggr_compatible() {
|
|
|
|
}
|
|
|
|
// return Err(AlgebraParseError::ScalarFnNotAllowed.into());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if let Ok(heads) = ex.clone().extract_aggr_heads() {
|
|
|
|
if let Ok(heads) = ex.clone().extract_aggr_heads() {
|
|
|
|
val_collectors.extend(heads)
|
|
|
|
val_collectors.extend(heads)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -344,11 +343,12 @@ impl<'a> WalkOp<'a> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let mut out = TupleSet::default();
|
|
|
|
let mut out = TupleSet::default();
|
|
|
|
out.vals.push(tuple.into());
|
|
|
|
out.vals.push(tuple.into());
|
|
|
|
|
|
|
|
last_tset = TupleSet::default();
|
|
|
|
Some(Ok(out))
|
|
|
|
Some(Ok(out))
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if !last_tset.keys.is_empty() {
|
|
|
|
let eval_ctx = TupleSetEvalContext {
|
|
|
|
let eval_ctx = TupleSetEvalContext {
|
|
|
|
tuple_set: &tset,
|
|
|
|
tuple_set: &last_tset,
|
|
|
|
txn: &txn,
|
|
|
|
txn: &txn,
|
|
|
|
temp_db: &temp_db,
|
|
|
|
temp_db: &temp_db,
|
|
|
|
write_options: &w_opts,
|
|
|
|
write_options: &w_opts,
|
|
|
@ -386,7 +386,7 @@ impl<'a> WalkOp<'a> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
last_tset = tset.into_owned();
|
|
|
|
last_tset = tset.into_owned();
|
|
|
|
None
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -504,7 +504,7 @@ impl<'b> RelationalAlgebra for WalkOp<'b> {
|
|
|
|
key_len: final_truncate_kv_size.0,
|
|
|
|
key_len: final_truncate_kv_size.0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let iter = self.build_selection_iter(it)?;
|
|
|
|
let iter = self.build_selection_iter(it, final_truncate_kv_size)?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(Box::new(iter))
|
|
|
|
Ok(Box::new(iter))
|
|
|
|
}
|
|
|
|
}
|
|
|
|