· 6 years ago · Jun 27, 2019, 12:10 PM
1create external table IF NOT EXISTS inputData ( lines string ) location '/user/maria_dev/data/';
2
3CREATE TABLE IF NOT EXISTS wordcount AS
4 SELECT word, count(1) AS
5 count FROM inputData LATERAL VIEW explode(split(lines, ' ')) lTable AS word GROUP BY word;
6
7CREATE TABLE IF NOT EXISTS classCount(class STRING, count INT);
8INSERT INTO classCount SELECT word, count FROM wordcount WHERE word LIKE 'class%';
9
10SELECT MIN(count) AS mindestanzahl, AVG(count) AS durchschnitt, MAX(count) AS maximalanzahl , SUM(count) AS summe FROM classCount;