Add test more test cases for distinct.
Add missing semicolons.
Add tests for error cases.