The previous code didn't actually make any sense. First, we can always trim joins as much as possible. The trim_joining logic guarantees we get the same value from trimmed joins. And, similarly to aggregation case there is no need to promote existing joins.