Skip to content

teraflow-ai/pizza-shop-pathway-vs-spark

 
 

Repository files navigation

Pizza Shop 🍕 - Pathway vs Spark

Code compliment to the blog post on this topic.

Infra and generated data used from https://github.com/startreedata/pizza-shop-demo.

Setup Python with Pyspark and Pathway

python -m venv .venv
source venv/bin/activate
export PATHWAY_KEY="your pathway api key"
pip install --extra-index-url https://packages.pathway.com/$PATHWAY_KEY -r requirements.txt

Spin Up Infrastructure

docker-compose \
  -f docker-compose-base.yml \
  -f docker-compose-dashboard-enriched-quarkus.yml \
  up -d

Run Spark Analysis

Customer Stats

spark-submit \
        --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.1 \
        spark/most_valuable_customers_stats.py

Total Pizzas Sold

spark-submit \
        --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.1 \
        spark/count_num_pizzas_sold.py

Languages

  • Python 64.9%
  • Java 28.7%
  • Dockerfile 6.4%