By the DISTRIBUTE BY … TRANSFORM clause Hive? code example
Example: groupby sort sql hive
SELECT
place,
cnt,
sum_
FROM (
SELECT
place,
count(*) as cnt,
sum(weight) as sum_
FROM a
GROUP BY place
) a
ORDER BY place;