Improved the handling of restricted join rules and improved the performance of local-first joins. Contributed by @nex.