module 3-1
module 3-1
Arrays - Arrays in Hive are used the same way they are used in
Java.
Syntax: ARRAY<data_type>
Maps - Maps in Hive are similar to Java Maps.
Syntax: MAP<primitive_type, data_type>
Structs - Structs in Hive is similar to using complex data with
comment.
Syntax: STRUCT<col_name : data_type [ COMMENT
col_comment, … ]>
Create Database
>STORED AS TEXTFILE;
Partition
•Hive organizes tables into partitions. It is a way of dividing a table
into related parts based on the values of partitioned columns such
as date, city, and department. Using partition, it is easy to query a
portion of the data.
•
JOIN
JOIN clause is used to combine and retrieve the
records from multiple tables. JOIN is same as
OUTER JOIN in SQL. A JOIN condition is to be
raised using the primary keys and foreign keys of
the tables.
hive> SELECT c.ID, c.NAME, c.AGE,
o.AMOUNT FROM CUSTOMERS c JOIN
ORDERS o ON (c.ID = o.CUSTOMER_ID);
Left Outer Join
The HiveQL LEFT OUTER JOIN returns all the rows from
the left table, even if there are no matches in the right
table. This means, if the ON clause matches 0 (zero)
records in the right table, the JOIN still returns a row in the
result, but with NULL in each column from the right table.