This project is designed to help you learn the concepts of Big Data Analytics as outlined in your syllabus. It simulates a "Big Data" pipeline using Python, SQLite, and Spark to analyze a synthetic movie ratings dataset.
- Concept: Processing large datasets by breaking them down (Map) and aggregating results (Reduce).
- Implementation:
mapper.py: Parses input lines and emitsmovieIdandrating.reducer.py: Aggregates ratings for each movie to calculate the average.run_mapreduce.sh: Simulates the Hadoop Streaming process using Unix pipes (|).
- Concept: Structuring data into tables and running SQL-like queries (HiveQL) for analysis.
- Implementation:
hive_simulation.py: Uses SQLite and Pandas to mimic a Hive Metastore.- Loads CSV data into tables.
- Runs queries to find top movies and analyze user activity, simulating Hive's aggregation capabilities.
- Concept: In-memory distributed processing for faster analytics using DataFrames and RDDs.
- Implementation:
spark_analytics.py: Uses PySpark (Apache Spark's Python API).- Demonstrates loading data into DataFrames.
- Performs complex transformations like exploding genres and joining datasets.
- Demonstrates RDD (Resilient Distributed Dataset) operations (
map,reduceByKey) to count ratings per user.
-
Generate Data:
python3 big_data_project/generate_data.py
This creates
movies.csv,users.csv, andratings.csvinbig_data_project/data/. -
Run MapReduce Simulation:
chmod +x big_data_project/run_mapreduce.sh big_data_project/mapper.py big_data_project/reducer.py ./big_data_project/run_mapreduce.sh
-
Run Hive/SQL Simulation:
python3 big_data_project/hive_simulation.py
-
Run Spark Analytics:
python3 big_data_project/spark_analytics.py
To deepen your understanding, try the following:
- MapReduce: Modify
mapper.pyandreducer.pyto count the number of ratings per user instead of average rating per movie. - Hive: Add a new query in
hive_simulation.pyto find the genre with the highest number of movies. - Spark: Modify
spark_analytics.pyto filter out movies with an average rating below 3.0 before showing the results.