Please consider de following case, the current implementation is not detecting the antipattern if it happens within a subquery
SELECT
tt1.sum_col2, count(1) ct
FROM
(SELECT
t1.col1, sum(t2.col2) sum_col2
FROM
t1
JOIN
t2 ON t1.col1 = t2.col2
GROUP BY
t1.col1 ) tt1
GROUP BY
tt1.sum_col2
Please consider de following case, the current implementation is not detecting the antipattern if it happens within a subquery