set up for join rewriting (test cases - detection)

A