Advanced DML
The Data Manipulation Language provided by Hive is equivalent in features to any state-of-the-art SQL system. They provide standard operations such as the JOIN
, GROUP BY
, and UNION
operations. The semantics might vary marginally depending on the operation. Different kinds of optimization hints are also present.
The GROUP BY operation
The GROUP BY
operation is the same as in standard SQL, except for a few advanced features:
- Multi-Group-By Inserts: It is possible to have multiple
GROUP BY
clauses within a single query. The output can be written to multiple tables or HDFS files. For example, the following query is possible:FROM src_table INSERT OVERWRITE TABLE id_count SELECT id, COUNT(id) GROUP BY id INSERT OVERWRITE TABLE id_sum SELECT ...
Get Hadoop: Data Processing and Modelling now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.