Skip to content
MDM
2025

NBA player tracking with Spark

Distributed Spark SQL jobs on a Hadoop cluster over player-tracking data from 84 NBA games, plus a vectorised nearest-neighbour search in C++.

Kind
Data engineering
Context
Big Data Analytics course, KU Leuven
Result
Three distributed jobs over 25-frames-per-second tracking data, and a SIMD speed-up of 1.3× to 3.8×.
Built with
Apache Spark, Spark SQL, Java, Hadoop, C++, SIMD
Status
Code private

The data

SportVU tracking data from 84 Golden State Warriors and Cleveland Cavaliers games in the 2015/16 NBA season: the x and y position of all ten players and the ball, 25 times per second, plus play-by-play events.

Three distributed jobs

Written in Java with Spark SQL, packaged as jars and run on the department's Hadoop cluster.

  • Distance per player. Distance travelled from frame-to-frame positions, combined with minutes played.
  • Speed zones. Speeds from window functions over each player, game and quarter, smoothed with a 10-frame moving average, filtered for noise and classified as slow, normal or fast. A cumulative-sum trick splits the data into runs and also catches substitution gaps.
  • Rebound detection. Rebounds found by combining ball-to-hoop and ball-to-player distances with the event data, giving rebounds per match per team and the furthest rebounds from the hoop.

What the data showed

  • 306 of 383 players never made a high-speed run.
  • Teams differ clearly in rebounds per match.
  • The furthest detected rebounds, around 28 m from the hoop, pointed to data or timestamp artefacts, a useful reminder to sanity-check results.

SIMD speed-up

A nearest-neighbour search in C++ using CPU vector instructions ran 1.3× to 3.8× faster than the scalar version on four datasets, the largest with 188,000 rows and 130 features.