Better way to handle distributed.by & More efficient way to find
distinct values for multiple columns

Scan the table only once to find all distinct values