Which statement correctly describes the difference between Delta Lake and Parquet regarding data updates?
Think about which format allows safe changes to existing data without rewriting everything.
Delta Lake adds a transaction log enabling ACID transactions, so you can update or delete data safely. Parquet files are just data files and are immutable, so you cannot update them directly.
Given a Delta Lake table and a Parquet file with the same data, what will be the output difference when reading them in Spark?
from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() delta_df = spark.read.format('delta').load('/path/to/delta_table') parquet_df = spark.read.parquet('/path/to/parquet_file') delta_count = delta_df.count() parquet_count = parquet_df.count() print(delta_count, parquet_count)
Consider that both read operations load the data content, but Delta Lake manages metadata differently.
If the data content is the same, both DataFrames will have the same number of rows. Delta Lake uses transaction logs internally but presents the current snapshot of data when read.
What error will occur when trying to append data with a new column to an existing Parquet dataset without schema merging?
df_new = spark.createDataFrame([(1, 'a', 10)], ['id', 'name', 'age']) df_new.write.mode('append').parquet('/path/to/parquet_dataset')
Think about how Parquet handles schema changes when appending data.
Parquet does not support automatic schema merging on append by default. Spark throws an AnalysisException unless schema merging is explicitly enabled.
You have a streaming data pipeline that requires exactly-once processing and frequent updates. Which storage format should you choose?
Consider which format supports exactly-once semantics and updates in streaming.
Delta Lake supports ACID transactions and is designed for streaming workloads with exactly-once guarantees. Parquet files are immutable and do not support updates natively.
Which Spark command will show the version history of a Delta Lake table to help visualize changes over time?
spark.sql("DESCRIBE HISTORY delta.`/path/to/delta_table`").show()Think about which command lists the commit history of a Delta table.
The DESCRIBE HISTORY command shows the commit history and metadata changes of a Delta Lake table. Other options either do not exist or do not show version history.
