Reputation: 23
I'm trying to compute a number of (unique) apparition of each element in a Hive table column regarding other columns.
I tried this query, but I've this error Expression not in GROUP BY key custom
SELECT custom, dist_pt, dt, art, COUNT(DISTINCT art) OVER (PARTITION BY custom, dist_pt) as nb_art FROM Tab ;
Upvotes: 0
Views: 731
Reputation: 499
Remove DISTINCT from your COUNT() and add "GROUP BY art" at the end of your query. You need to segment, or group by, art in order to count how many records have each unique value of art.
Upvotes: 1