Added support for 'distinct' operator in queries