HiveSQL实现WordCount

    技术2023-11-22  91

    先把句子拆成单个单词,再行专列,再利用子查询做聚合。

    select word, count(1) as cnts from (select explode(split(sentence, ",")) as word from table) t group by word order by cnts desc;
    Processed: 0.013, SQL: 9