Imagine a data platform that updates user activity data every hour. Which pipeline design aspect most directly impacts how fresh the data is for analysis?
Think about what controls how often new data arrives in the system.
Data freshness depends on how often the pipeline runs to bring in new data. Scheduling ingestion jobs frequently ensures up-to-date data.
Given the Spark code below, what will be the output count of the final DataFrame?
from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() data = [(1, 'A'), (2, 'B'), (3, 'C'), (4, 'D')] df = spark.createDataFrame(data, ['id', 'value']) df_filtered = df.filter(df.id > 2).cache() count1 = df_filtered.count() count2 = df_filtered.count() print(count2)
Consider how filtering and caching affect the number of rows.
The filter keeps rows with id > 2, which are (3, 'C') and (4, 'D'), so count is 2. Caching does not change the count.
Review the Spark pipeline code below. Which part is most likely causing slow performance?
df = spark.read.parquet('data/events') df_grouped = df.groupBy('user_id').count() df_sorted = df_grouped.sort('count', ascending=False) df_sorted.show()
Think about which Spark operations cause expensive data movement.
GroupBy triggers a shuffle across the cluster, which is expensive and often the main bottleneck in Spark pipelines.
You see a time series plot showing pipeline run durations over a week. On some days, the duration spikes significantly. What does this indicate about pipeline quality?
Look for what spikes in duration usually mean in pipelines.
Spikes in run duration indicate instability or bottlenecks causing delays, which lowers pipeline quality.
You manage a data platform that must handle large data volumes with minimal downtime. Which pipeline design choice best improves reliability?
Think about how modular design and checkpoints help recover from failures.
Modular pipelines with checkpoints allow restarting from intermediate points, reducing downtime and improving reliability.
