Hive File Format
Hive File Format
Types of Partitioning
1. Static Partitioning
User manually assigns data to partitions.
Example: Placing State A’s data in a folder named State_A.
2. Dynamic Partitioning
Hive automatically creates partitions based on unique values in a column.
Static Partitioning
Aggregation
Hive supports functions like AVG, COUNT, etc.
Objective: Perform aggregation functions.
SELECT AVG(gpa) FROM STUDENT;
SELECT COUNT(*) FROM STUDENT;
GROUP BY and HAVING
GROUP BY groups data based on column values. HAVING filters groups that meet a condition.
Objective: Group by rollno, name, and gpa, and filter gpa > 4.0.
SELECT rollno, name, gpa
FROM STUDENT
GROUP BY rollno, name, gpa
HAVING gpa > 4.0;