We perform plan consistency checks after each optimizer run to ensure that plan nodes only reference attributes that are actually in the output of the upstream plan(s).
We don't perform such checks after the analyzer has run, which allowed a bug in union types (#137187) to stay in place since union types were first introduced. (The optimizer "fixed" the wrong plan created by the analyzer, so tests didn't catch that.)
We should perform the same checks after the analyzer has run, so we know that the plan was already analyzed incorrectly, rather than looking for bugs in all our optimizer rules. This could be added to the verifier.
We perform plan consistency checks after each optimizer run to ensure that plan nodes only reference attributes that are actually in the output of the upstream plan(s).
We don't perform such checks after the analyzer has run, which allowed a bug in union types (#137187) to stay in place since union types were first introduced. (The optimizer "fixed" the wrong plan created by the analyzer, so tests didn't catch that.)
We should perform the same checks after the analyzer has run, so we know that the plan was already analyzed incorrectly, rather than looking for bugs in all our optimizer rules. This could be added to the verifier.