Closed
Description
related #121950
The constant folding does not work correctly for FORK.
This is one symptom of how we carry and reuse the column references in FORK from the FORK sub plans.
Take this example:
FROM search-movies METADATA _id
| FORK ( EVAL a = 1 | WHERE _id == "1" )
( EVAL a = 2 | WHERE _id == "2" )
| KEEP _id, _fork, a
| WHERE a == 1
This should only return the results of the first FORK branch, but it ends up returning both.
The reason for this is because when constant folding is done at the level of the logical plan optimizer the condition | WHERE a == 1
becomes WHERE true
. The reference for the a
column is the one from the first FORK branch.
We should fix the output of FORK, such that we don't reuse the same columns references from the FORK branches.
I assume STATS
does something similar, but I haven't checked yet.