Hive - HiveQL

> Database > Apache - Hive (HS|Hive Server)

1 - Documentation / Reference

2 - Cheetsheet

2.1 - Show / Describe

SHOW TABLES;
SHOW FUNCTIONS;
DESCRIBE FUNCTION <function_name>;
DESCRIBE FUNCTION EXTENDED <function_name>;
SET; -- all
SET hive.execution.engine; -- one
Advertising

2.2 - Table

CREATE TABLE page_view(viewTime INT, userid BIGINT,
                page_url STRING, referrer_url STRING,
                ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(dt STRING, country STRING)
CLUSTERED BY(userid) SORTED BY(viewTime) INTO 32 BUCKETS
ROW FORMAT DELIMITED
        FIELDS TERMINATED BY '1'
        COLLECTION ITEMS TERMINATED BY '2'
        MAP KEYS TERMINATED BY '3'
STORED AS SEQUENCEFILE;

where: clustered = Hive - Bucket (Cluster)

db/hive/hiveql.txt · Last modified: 2019/05/21 12:42 by gerardnico