Ollie
From this part, we will move into more practical examples.
For the rest of this tutorial series, we will work with clickstream events from a fictional Oleander retail website. Unfortunately, we do not have a real retail site for this tutorial, so we created a virtual one instead. Users visit the site, browse products, view product pages, add items to their cart, and complete purchases.
By analyzing this data, we will learn some of the practical analytics capabilities Spark provides. Just as importantly, we will also start building the mindset needed for real data analysis: taking raw event data and turning it into something understandable and useful.
Getting the Sample Data
For this tutorial, we generated a sample retail clickstream dataset and uploaded it to S3.
Download it with the following command:
curl -L \ -o retail_clickstream_events_7d.parquet \ https://oleander-iceberg-spark-tutorials.s3.us-east-2.amazonaws.com/retail_clickstream_events_7d.parquetThis file contains 7 days of clickstream events from the fictional Oleander retail website.
Creating an Iceberg Table
To get started, let’s create an Iceberg table from this file using the interactive shell.
spark.conf.set("spark.sql.session.timeZone", "UTC")
spark.read.parquet("retail_clickstream_events_7d.parquet") \ .writeTo("oleander.tutorial.retail_clickstream_events") \ .using("iceberg") \ .createOrReplace()This reads the Parquet file and creates an Iceberg table named oleander.tutorial.retail_clickstream_events.
Now confirm that the table was created:
spark.sql("SHOW TABLES IN oleander.tutorial").show(truncate=False)Looking at the Data
Now that the table has been created, let’s take a quick look at the data.
spark.sql(""" SELECT * FROM oleander.tutorial.retail_clickstream_events LIMIT 10""").show()This shows the first 10 rows from the table.
At this point, do not worry too much about understanding every column or every event type yet. The important thing is that we now have a realistic dataset stored as an Iceberg table, and we are ready to start analyzing it.
Summary
In this part, we downloaded a sample retail clickstream dataset, loaded it into Spark, and created an Iceberg table from it.
That gives us the raw data we will use in the next parts of this tutorial series.
From the next part on, we will start turning this raw event data into more comprehensible and useful information.