Class PruneEmptyForkBranches


public class PruneEmptyForkBranches extends OptimizerRules.OptimizerRule<Fork>
Removes FORK branches or subqueries from UnionAll that only contain an empty LocalRelation. The simplest case where this can happen is when a FORK branch contains WHERE false. In practice, empty FORK branches can also happen when FORK is used for conditional execution of the query based on query parameters:
FROM my-index METADATA _score
| ...
| FORK ( SORT _score | LIMIT 10) // return top hits every time
       ( WHERE ?include_completion | STATS s = values(title) | COMPLETION ...)