A Hive-based movie-rating analytics and visualisation system covering warehouse modelling, HDFS storage and interactive reporting.
34p
system report
03
core tables
SQL
warehouse analysis
01 / Overview
What this package actually contains.
The Hive coursework built a movie-rating warehouse over HDFS and used Hive SQL to answer questions about genre quality, regional preferences and the relationship between ratings and release year.
Objectives
01Ingest MovieLens-style users, movies and ratings into Hive tables.
02Model the data for SQL aggregation and window-function analysis.
03Produce ranked genre and regional movie results suitable for visualisation.
Data flow
From raw records to a usable service.
The pipeline is the main story: ingestion, storage, processing and serving.
01→
MovieLens files
Users, ratings and movie metadata separated by multi-character delimiters.
02→
Hive tables
RegexSerDe definitions and HDFS-backed external data.
03→
SQL layer
CTEs, explode, joins and window functions.
04→
Docker stack
Hadoop, Hive, YARN and MySQL metadata services.
05
Reporting
Top genres by year and top movies by region.
02 / Package highlights
What this work demonstrates.
Demonstrates SQL-style aggregation and warehouse design over HDFS.
Uses a Docker-based stack with Hive, Hadoop, YARN and MySQL metadata services.
Extends the data-engineering portfolio beyond Spark and HBase.
03 / Implementation
Where the engineering complexity sits.
01
Semi-structured input handling
The raw MovieLens files use :: delimiters rather than standard CSV. The Hive tables therefore use RegexSerDe with explicit capture groups, preserving the original IDs and textual fields without a pre-processing file rewrite.
Ratings are loaded from ratings.dat into a typed Hive table.
Movie titles are parsed to extract a four-digit release year.
Genres are exploded from a pipe-delimited field into one row per genre.
02
Window-function analysis
The analytical queries aggregate ratings by movie, join movie metadata, then use ROW_NUMBER() partitioned by year or region. This produces a ranked result without hand-written loops or client-side sorting.
CTEs keep each aggregation step readable.
The year/genre query finds the highest-rated genre per year.
The regional query finds the highest-rated movie per postal region.
04 / Key code
Code that defines the pipeline.
Only verified source excerpts and pseudocode taken from the project papers are shown.
Verified project codeHive SQL
RegexSerDe ratings table
Original Hive DDL for loading MovieLens ratings with :: delimiters.
moviedb_ratings_rebuild.sql
USE moviedb;
CREATE TABLE ratings (
userid BIGINT,
movieid BIGINT,
rating DOUBLE,
rating_time STRING
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
'input.regex'='^(.+?)::(.+?)::(.+?)::(.+?)$',
'output.format.string' = '%1$s %2$s %3$s %4$s'
)
STORED AS TEXTFILE;
LOAD DATA LOCAL INPATH '/tmp/ratings.dat'
OVERWRITE INTO TABLE ratings;
Verified project codeHive SQL
Top genre per year
Original Hive query using CTEs, explode and a partitioned window function.
step08.sql
WITH movie_ratings AS (
SELECT movieid, AVG(rating) AS rating_avg
FROM rating
GROUP BY movieid
),
movie_with_year_genre AS (
SELECT
movieid,
CAST(SUBSTR(title, -5, 4) AS INT) AS year,
explode(split(genres, '\\|')) AS genre
FROM movie
WHERE title RLIKE '\\(\\d{4}\\)$'
),
ranked_genres AS (
SELECT
year,
genre,
AVG(rating_avg) AS genre_avg_rating,
ROW_NUMBER() OVER (
PARTITION BY year
ORDER BY AVG(rating_avg) DESC, genre ASC
) AS rn
FROM movie_with_year_genre
JOIN movie_ratings USING (movieid)
GROUP BY year, genre
)
SELECT year, genre, ROUND(genre_avg_rating, 3)
FROM ranked_genres
WHERE rn = 1
ORDER BY year;
Operational notes
RegexSerDe avoids an extra parsing step for the :: delimiter format.
Window functions push ranking into the warehouse instead of the UI.
The Docker setup makes the multi-service Hadoop/Hive environment repeatable.
Limitations / next steps
A production warehouse would use partitioned ORC/Parquet tables rather than text files.
The current dataset is small enough that interactive query latency is not representative of scale.
05 / Downloads
Files in this folder.
Open the original report, presentation or source archive. PDF cover pages with private details were removed.
PDF
Movie analytics report
中文 · 33 pages · 3.0 MB
Sanitized 33-page report on the data model and visual analytics system.