Rewrites filtering around join operators