Allow to have non-distinct queries
Merge branch 'DDC-2548' into 2.4
Fixed DDC-1884.
CS fixes.
Merge branch 'DDC-2582' into 2.4