This query will hit a w2 window definition not found in `WindowSubstitute` rule, however this is a bug since the w2 definition is defined in the query.
create or replace temporary view test_temp_view as
with step_1 as (
select * , min(a) over w2 as min_a_over_w2 from (select 1 as a, 2 as b, 3 as c) window w2 as (partition by b order by c)) , step_2 as
select *, max(e) over w1 as max_a_over_w1
from (select 1 as e, 2 as f, 3 as g)
join step_1 on true
window w1 as (partition by f order by g)
Also we can move the unresolved window expression check from `WindowSubstitute` rule to `CheckAnalysis` phrase.