mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
Fix referencing virtual table predicates
We need to enumerate first and filter afterward — not the other way around — because we later use the indexes produced by `enumerate` to access the original `predicates` slice.
This commit is contained in:
@@ -457,8 +457,8 @@ pub fn open_loop(
|
||||
// We then materialise the RHS/LHS into registers before issuing VFilter.
|
||||
let converted_constraints = predicates
|
||||
.iter()
|
||||
.filter(|p| p.should_eval_at_loop(join_index, join_order))
|
||||
.enumerate()
|
||||
.filter(|(_, p)| p.should_eval_at_loop(join_index, join_order))
|
||||
.filter_map(|(i, p)| {
|
||||
// Build ConstraintInfo from the predicates
|
||||
convert_where_to_vtab_constraint(
|
||||
|
||||
@@ -442,6 +442,10 @@ def _test_kv(exec_name, ext_path):
|
||||
lambda res: res == "100|updated2",
|
||||
"there is only 1 key remaining after setting all keys to same value",
|
||||
)
|
||||
limbo.run_test_fn(
|
||||
"select * from t a, other b where b.c = 23 and a.key='100';",
|
||||
lambda res: "100|updated2|23|32|23" == res,
|
||||
)
|
||||
limbo.quit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user