Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**Why syntax + semantics matter**: RDD vs DataFrame choice affects optimization; load options impact parallelism. **Commands**: Create RDD: `sc.parallelize([1,2,3])` or `sc.textFile("path")`. Load: `textFile`, `wholeTextFiles`, `sequenceFile` (RDD); `spark.read.csv()`,...
Why syntax + semantics matter: RDD vs DataFrame choice affects optimization; load options impact parallelism. Commands: Create RDD: sc.parallelize([1,2,3]) or sc.textFile("path"). Load: textFile, wholeTextFiles, sequenceFile (RDD); spark.read.csv(), spark.read.parquet() (DataFrame). Filter: rdd.filter(lambda x: x > 0); df.filter(col("status") == "active"). Scalability trade-offs: textFile partitions by block; wholeTextFiles one partition per file—bad for many small files. DataFrame with schema avoids schema inference cost on large reads. Cost implications: Inferring schema on 1TB = expensive scan; provide schema for production. Best practice: Prefer DataFrame; use schema; leverage columnar formats.
Red Flag: Using RDD for production ETL. Pro-Move: 'We use read.parquet with schema; filter before join for prune.'
According to DataEngPrep.tech, this is one of the most frequently asked Spark/Big Data interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.