bug fix in IndexStatementRewriter and JoinCompiler
Merge pull request #692 from maryannxue/master

Fix issue#689 Self-join does not work