Eng 6436 distinct reroute

I think that you will be in trouble here, as well as any case that has no GROUP BY but has an agg in the select or the having.