General Information
SSD: ING-INF/05 – CFU: 6 – Link to the official Teaching Portal web page
Professor: Daniele Apiletti
Teaching Assistant: Matteo Boffa
Q&A teaching assistance on Piazza: Piazza.com/polito.it/fall2025/01qydov
Announcements
- Lab activities will start on Thursday 09/10/2025 .
- We are using Piazza for class discussion. We invite all students toΒ join the course Piazza. Piazza is highly catered to getting help fast and efficiently from classmates and teachers. Rather than emailing questions to the teaching staff, students are invited to post their questions on Piazza.
Teaching Material
- Introduction to Apache Hadoop and the MapReduce programming paradigm (slides)
- Interaction with HDFS and Hadoop using the command line (slides)
- Hadoop implementation of MapReduce (slides)
- BigData@Polito environment + Jupyter β How to submit MapReduce jobs on BigData@Polito (slides)
- MapReduce and Hadoop β Advanced Topics: Multiple inputs, Multiple outputs, Distributed cache (slides)
- MapReduce β Design patterns β Part 1 (slides)
- MapReduce β Design patterns β Part 2 (slides)
- MapReduce β Relational Algebra/SQL operators (slides)
- Introduction to Apache Spark (slides)
- How to submit Spark applications (slides)
- How to use Jupyter Notebooks for your Spark applications (pdf)
- You can install PySpark and JupyterLab usingΒ Conda/Miniconda/pipΒ (instructions here)
- RDD-based programs RDDs
- Creation, basic transformations, and actions (slides) – Notebook with some examples from the slides (FirstExamplesNotebook.zip)
- Key-value pair RDDs: transformations and actions on PairRDDs (slides)
- Inner join, left outer join, right outer join, full outer join, and βNOT INβ with PairRDDs: Examples β Notebook (JoinsRDD.zip)
- DoubleRDDs (slides)
- Advanced Topics: Cache, accumulators, broadcast variables (slides)
- Notebooks with some examples (ExamplesAccumulatorPython.zip)
- Spark SQL, Datasets, and DataFrames (slides)
- Spark SQL β Join examples (ExamplesSparkSQLJoins.zip)
- Spark MLlib
- Introduction to MLlib (slides)
- Classification of structured data and textual data (slides)
- Classification example code (zip)
- Regression (slides)
- Linear regression example code (zip)
- Clustering of structured data (slides)
- Clustering example code (zip)
- Itemset and Association rule mining (slides)
- Itemset and Association rule mining example code (zip)
- Spark Streaming (slides)
- Simple examples β Jupyter notebooks (SparkSteamingExamples.zip)
Exercises
If you use your PC to write and run your code, import the projects based on Maven (those projects can be run locally).
If you use the PC available in the LAB, import the projects with libraries (those projects cannot be run locally but only on the cluster exporting the project’s jar file). Refer to the Laboratory Material section for more information.
- MapReduce exercises (slides)
- Solutions of Exercises 1-29 (ποΈSolutionsExMapReduce.zip)
- Spark RDD-based exercises (slides)
- Example data β One folder with (few) data for each exercise (ποΈExampleDataSpark.zip)
- Solutions of Exercises 30-46 (ποΈSolutionsExSpark30-46.zip)
- Solution of Ex.44 based on Left Outer Join (ποΈex44LeftOuterJoin.zip)
- Solution of Ex.46 based on SparkSQL API + RDD groupByKey – Example to show how to create and manage “static windows” with almost only Spark SQL APIs (ποΈex46_DF.zip)
- Solutions of Exercises from 32 to 38 and 44 based on Spark SQL (ποΈSolSparkSQL32-38_44.zip)
- Spark SQL-based exercises (slides)
- Example data – One folder with (few) data for each exercise (ποΈExampleDataSparkSQL.zip)
- Solutions of Exercises 47-50 (ποΈSolutionsExSpark47-50.zip)
- Spark streaming exercises (slides)
- Solutions of Exercises 58-65 (ποΈSolutionsSparkStreaming58_65.zip)
Laboratory Material
Lab activities will start on Thursday 09/10/2025 at LAIB1T.
| Student Group | Time | Room |
| Team A: Students from A to L | Thursday, 08:30-10:00 | LAIB 1T |
| Team B: Students from M to Z | Thursday, 10:00-11:30 | LAIB 1T |
We suggest the use of Visual Studio Code for the lab sessions. For the configuration instructions, refer to this πguide.
Windows users only: You must configure the winutils (ποΈwinutils.zip) and set up some environmental variables. Follow this πextra guide for the complete configuration.
All the Laboratory materials are available in multiple versions. The version with libraries is the only one you can use on the Lab computers (without running locally). All the other versions are Maven projects, so you can use them locally on your laptop, depending on your OS and the cluster. The legend for the buttons is the following:
πlib: with libraries, π§mavU: Maven project for Linux/MacOS, πͺmavW: Maven project for Windows (Hadoop projects only)
- Basic project for MapReduce applications (πlib, π§mavU, πͺmavW)
- Local PySpark installation guide here
Lab1: Hadoop and MapReduce
Problem specification (πpdf)
Basic project and small example data set πlib, π§mavU, πͺmavW)
Bigger data set: finefoods_text.txt (ποΈzip)
Solution (Bonus track π§mavU)
Lab2: Filter with Hadoop MapReduce and Frequency Count
Problem specification (πpdf)
Skeleton Hadoop Projects (πlib, π§mavU, πͺmavW)
Dataset (only if you run locally): OutputLab1 (ποΈzip)
Lab3: Frequently bought/reviewed together with Hadoop and MapReduce
Problem specification (πpdf)
Skeleton Hadoop Projects (πlib, π§mavU, πͺmavW)
Dataset (only if you run locally): AmazonReviews (ποΈtxt)
Solutions:
– Code (The second solution MUST NOT BE USED because it is highly inefficient.)
– Slides (Guidelines on solution codes)
Lab 4: Normalized ratings for product recommendations with Hadoop MapReduce
Problem specification (πpdf)
Skeleton Hadoop Projects (πlib, π§mavU, πͺmavW)
Sample file: AmazonTransposedDataset (πcsv)
Solutions:
Lab4_Sol.zip
Lab 5: Filter data and compute basic statistics with Apache Spark
Problem specification (πpdf)
Input file – also in the Cluster (OutputLab1.csv)
Solutions:
Lab5_Sol.zip
Lab 6: Frequently bought/reviewed together with Apache Spark
Problem Specification (πpdf)
Sample file (ReviewsSample.csv)
Expected output β Task 1 (if input is Reviews.csv) (outputTask1Lab6.zip)
Solution:
Lab6_Sol.zip
Lab 7: Bike sharing data analysis
Problem specification (π pdf)
Sample data (sampleData.zip)
Example KML file (exampleKML.zip)
Expected output:
— Execution on sample data (sampleData/registerSample.csv and sampleData/stations.csv) and minimum criticality threshold = 0.4 (part-00000)
— Execution on complete data (/share/students/bigdata/Dati/Lab7/datiCompleti/register.csv and /share/students/bigdata/Dati/Lab7/datiCompleti//stations.csv) and minimum criticality threshold = 0.6 (part-00000)
Solution:
Guidance slides: Lab7 – Critical Timeslot detection
Solution: Lab7_Sol.zip
Lab 8: Bike sharing data analysis based on Spark SQL
Problem specification (π pdf)
Sample data (sampleData.zip)
Solution: Lab8_Sol.zip
Lab 9: A classification pipeline with MLlib + Spark SQL
Problem specification (π pdf)
Sample file with 100 reviews (ReviewsSample.csv)
Template (Lab9_template.zip)
Bigger file with all reviews (Reviews.zip)
Exam examples
Since academic year 2022/23, the exam is open book.
| Exams | Solutions |
| Spark Streaming β Examples of multiple choice questions (pdf) – Python-based version – Updated on December 18, 2024 | Question 1: (c) Question 2: (d) Question 3: (b) |
| September 12, 2024: pdf | Question 1: (b) Question 2: (a) Source code: zip – Spark – Python-based solution |
| June 20, 2024: pdf | Question 1: (b) Question 2: (a) Source code: zip – Spark – Python-based solution |
| February 19, 2024: pdf | Question 1: (a) Question 2: (b) Source code: zip – Spark – Python-based solution |
| February 5, 2024: pdf | Question 1: (a) Question 2: (b) Source code: zip – Spark – Python-based solution A solution based on Spark SQL is available for this exam |
| September 21, 2023: pdf | Question 1: (a) Question 2: (b) |
| June 21, 2023: pdf | Question 1: (c) Question 2: (d) |
| February 15, 2023: pdf | Question 1: (c) Question 2: (b) Source code: zip – Spark – Python-based solution A solution based on Spark SQL is available for this exam |
| February 2, 2023: pdf | Question 1: (d) Question 2: (d) Source code: zip – Spark – Python-based solution A solution based on Spark SQL is available for this exam |
| September 6, 2022: pdf | Question 1: (c) Question 2: (d) Source code: zip – Spark – Python-based solution A solution based on Spark SQL is available for this exam |
| July 4, 2022: pdf | Question 1: (c) Question 2: (d) Source code: zip – Spark – Python-based solution |
| February 21, 2022: pdf | Question 1: (d) Question 2: (b) Source code: zip – Spark – Python-based solution A solution based on Spark SQL is available for this exam |
| February 2, 2022: pdf | Question 1: (b) Question 2: (d) Source code: zip – Spark – Python-based solution |
| June 30, 2021: pdf | Question 1: (a) Question 2: (c) Source code: zip |
| February 5, 2021: pdf | Question 1: (b) Question 2: (c) Source code: zip |
| September 17, 2020: pdf | Question 1: (d) Question 2: (c) Source code: zip |
| July 16, 2020: pdf | Question 1: (b) Question 2: (b) β Note that there are two actions; hence, the input file is read twice. Source code: zip |
| July 2, 2020: pdf | Question 1: (b) Question 2: (a) Source code: zip |
| July 18, 2019: pdf | Question 1: (b) Question 2: (b) Source code: zip |
| July 2, 2019: pdf | Question 1: (a) Question 2: (b) Source code: zip |
| February 15, 2019: pdf | Question 1: (d) Question 2: (c) Source code: zip |
| September 3, 2018: pdf | Question 1: (d) Question 2: (c) Source code: zip |
| July 16, 2018: pdf | Question 1: (d) Question 2: (a) Source code: zip |
| June 26, 2018: pdf | Question 1: (c) Question 2: (c) Source code: zip |
Additional material
- Slides and screencasts about Java (kindly provided by prof. Torchiano) (link)
- Suggested slides/lectures for those students who have never used Java
- OO Paradigm and UML (The UML part is not mandatory)
- The Java Environment
- Java Basic Features
- Java Inheritance
- Suggested slides/lectures for those students who have never used Java
