Propagate distinct status when cloning queries.

Fixes issue where distinct state is lost if not last command.