Support for 'distinct' and 'null' queries