Fix bug of distinct select.
Support In-memory Distinct