DISTINCT argument in Join method

if all joins are marked as distinct then we can
avoid distincting whole query.
DISTINCT argument in Join and NewAlias

We have hidden joins_are_distinct to indicate that all joins
are distinct, but it's only useful when all joins and limits
are within one function and SB object is not passed around.

By using DISTINCT argument a new join can be marked as distinct.
If all joins are marked as distinct then whole query is distinct
and we can avoid DB side distinct operations.
Merge branch 'distinct-argument-in-joins'