Spark SQL & Catalyst interview questions

81 real Spark SQL & Catalyst questions from the Big Data bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is Whole-stage code generation?

Junior
  1. A.a Catalyst optimization that compiles a chain of operators in a stage into a single fused Java function to cut virtual-call and iterator overhead
  2. B.the Catalyst component (spark.sql.cbo.enabled) that reorders joins and picks physical operators using collected table and column statistics
  3. C.a Spark table layout that hash-distributes rows into a fixed number of files per column so joins and aggregations on that column can skip the shuffle
  4. D.an optimization that pushes filter conditions down to the data source so fewer rows or files are read
Reveal the answer + AI explanation — free account

2. Which term means: "a Catalyst optimization that compiles a chain of operators in a stage into a single fused Java function to cut virtual-call and iterator overhead"?

Junior
  1. A.Whole-stage code generation
  2. B.broadcast hint
  3. C.Predicate pushdown
  4. D.window function
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.Whole-stage code generation — the Catalyst component (spark.sql.cbo.enabled) that reorders joins and picks physical operators using collected table and column statistics
  2. B.Whole-stage code generation — a Catalyst optimization that compiles a chain of operators in a stage into a single fused Java function to cut virtual-call and iterator overhead
  3. C.Whole-stage code generation — a Common Table Expression, a named temporary result defined with WITH that improves readability and can be referenced multiple times in a query
  4. D.Whole-stage code generation — a Spark SQL hint (/*+ BROADCAST(t) */) forcing the optimizer to broadcast a small table to all executors for a map-side join
Reveal the answer + AI explanation — free account

4. What is Logical plan?

Mid
  1. A.the tree of relational operators Spark builds and rewrites through analysis and optimization rules before producing physical plans
  2. B.an optimization that pushes filter conditions down to the data source so fewer rows or files are read
  3. C.the resolved tree of relational operators produced before physical planning, on which rule-based optimizations are applied
  4. D.the ROWS or RANGE clause defining which rows around the current row a window function aggregates, such as ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
Reveal the answer + AI explanation — free account

5. Which term means: "the resolved tree of relational operators produced before physical planning, on which rule-based optimizations are applied"?

Mid
  1. A.table statistics
  2. B.Physical plan
  3. C.Column pruning
  4. D.Logical plan
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. A.Logical plan — a Spark SQL hint (/*+ BROADCAST(t) */) forcing the optimizer to broadcast a small table to all executors for a map-side join
  2. B.Logical plan — collected row counts and column histograms (gathered via ANALYZE TABLE) that the cost-based optimizer uses to choose join order and strategy
  3. C.Logical plan — the tree of relational operators Spark builds and rewrites through analysis and optimization rules before producing physical plans
  4. D.Logical plan — the resolved tree of relational operators produced before physical planning, on which rule-based optimizations are applied
Reveal the answer + AI explanation — free account

7. What is Physical plan?

Mid
  1. A.the executable plan of physical operators (chosen join strategies, exchanges) selected by Catalyst using cost and rules
  2. B.the Spark SQL mode (default in Spark 4) that enforces standard SQL semantics, throwing errors on overflow, divide-by-zero, and invalid casts instead of silently returning null
  3. C.an optimization that pushes filter conditions down to the data source so fewer rows or files are read
  4. D.the Catalyst technique that compiles a chain of operators into a single fused Java function to remove virtual-call and iterator overhead
Reveal the answer + AI explanation — free account

8. Which term means: "the executable plan of physical operators (chosen join strategies, exchanges) selected by Catalyst using cost and rules"?

Mid
  1. A.Predicate pushdown
  2. B.Catalyst logical plan
  3. C.Physical plan
  4. D.Whole-stage code generation
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.Physical plan — the Spark SQL mode (default in Spark 4) that enforces standard SQL semantics, throwing errors on overflow, divide-by-zero, and invalid casts instead of silently returning null
  2. B.Physical plan — the executable plan of physical operators (chosen join strategies, exchanges) selected by Catalyst using cost and rules
  3. C.Physical plan — a Spark SQL hint (/*+ BROADCAST(t) */) forcing the optimizer to broadcast a small table to all executors for a map-side join
  4. D.Physical plan — an optimization that pushes filter conditions down to the data source so fewer rows or files are read
Reveal the answer + AI explanation — free account

10. What is Predicate pushdown?

Mid
  1. A.the executable plan of physical operators (chosen join strategies, exchanges) selected by Catalyst using cost and rules
  2. B.an optimization that pushes filter conditions down to the data source so fewer rows or files are read
  3. C.a Spark SQL hint (/*+ BROADCAST(t) */) forcing the optimizer to broadcast a small table to all executors for a map-side join
  4. D.a SQL construct computing a value over a frame of rows related to the current row (using OVER with PARTITION BY and ORDER BY) without collapsing them into a group
Reveal the answer + AI explanation — free account

11. Which term means: "an optimization that pushes filter conditions down to the data source so fewer rows or files are read"?

Mid
  1. A.Predicate pushdown
  2. B.whole-stage code generation
  3. C.Cost-based optimization
  4. D.bucketing
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.Predicate pushdown — a Common Table Expression that references itself to traverse hierarchies, supported in Spark SQL from version 3.5 onward
  2. B.Predicate pushdown — the Parquet and ORC reader path in Spark that decodes batches of column values at once into in-memory column vectors for cache-friendly processing
  3. C.Predicate pushdown — an optimization that pushes filter conditions down to the data source so fewer rows or files are read
  4. D.Predicate pushdown — an optimization that reads only the columns referenced by a query, especially effective on columnar formats like Parquet
Reveal the answer + AI explanation — free account

13. What is Column pruning?

Mid
  1. A.an AQE feature that splits oversized skewed partitions into smaller sub-partitions so one task does not dominate a join
  2. B.an optimization that reads only the columns referenced by a query, especially effective on columnar formats like Parquet
  3. C.an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table
  4. D.the ROWS or RANGE clause defining which rows around the current row a window function aggregates, such as ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
Reveal the answer + AI explanation — free account

14. Which term means: "an optimization that reads only the columns referenced by a query, especially effective on columnar formats like Parquet"?

Mid
  1. A.Catalyst logical plan
  2. B.Cost-based optimization
  3. C.window function
  4. D.Column pruning
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.Column pruning — a SQL construct computing a value over a frame of rows related to the current row (using OVER with PARTITION BY and ORDER BY) without collapsing them into a group
  2. B.Column pruning — a Catalyst optimization that compiles a chain of operators in a stage into a single fused Java function to cut virtual-call and iterator overhead
  3. C.Column pruning — an optimization that reads only the columns referenced by a query, especially effective on columnar formats like Parquet
  4. D.Column pruning — the Catalyst technique that compiles a chain of operators into a single fused Java function to remove virtual-call and iterator overhead
Reveal the answer + AI explanation — free account

16. What is Dynamic partition pruning?

Senior
  1. A.a Catalyst optimization that compiles a chain of operators in a stage into a single fused Java function to cut virtual-call and iterator overhead
  2. B.the Spark SQL mode (default in Spark 4) that enforces standard SQL semantics, throwing errors on overflow, divide-by-zero, and invalid casts instead of silently returning null
  3. C.an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table
  4. D.a Catalyst mode that uses table and column statistics to pick join order and join strategies
Reveal the answer + AI explanation — free account

17. Which term means: "an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table"?

Senior
  1. A.Dynamic partition pruning
  2. B.broadcast hint
  3. C.whole-stage code generation
  4. D.Cost-based optimization
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Senior
  1. A.Dynamic partition pruning — the tree of relational operators Spark builds and rewrites through analysis and optimization rules before producing physical plans
  2. B.Dynamic partition pruning — an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table
  3. C.Dynamic partition pruning — an optimization that reads only the columns referenced by a query, especially effective on columnar formats like Parquet
  4. D.Dynamic partition pruning — the Catalyst component (spark.sql.cbo.enabled) that reorders joins and picks physical operators using collected table and column statistics
Reveal the answer + AI explanation — free account

19. What is Cost-based optimization?

Senior
  1. A.a Common Table Expression, a named temporary result defined with WITH that improves readability and can be referenced multiple times in a query
  2. B.the ROWS or RANGE clause defining which rows around the current row a window function aggregates, such as ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
  3. C.a Catalyst mode that uses table and column statistics to pick join order and join strategies
  4. D.the resolved tree of relational operators produced before physical planning, on which rule-based optimizations are applied
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Senior
  1. A.Cost-based optimization — a Catalyst mode that uses table and column statistics to pick join order and join strategies
  2. B.Cost-based optimization — an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table
  3. C.Cost-based optimization — a SQL construct computing a value over a frame of rows related to the current row (using OVER with PARTITION BY and ORDER BY) without collapsing them into a group
  4. D.Cost-based optimization — a Common Table Expression that references itself to traverse hierarchies, supported in Spark SQL from version 3.5 onward
Reveal the answer + AI explanation — free account

22. What is Skew join optimization?

Senior
  1. A.the Catalyst technique that compiles a chain of operators into a single fused Java function to remove virtual-call and iterator overhead
  2. B.an AQE-related optimization that prunes fact-table partitions at runtime using the filtered keys of a joined dimension table
  3. C.an AQE feature that splits oversized skewed partitions into smaller sub-partitions so one task does not dominate a join
  4. D.a SQL construct computing a value over a frame of rows related to the current row (using OVER with PARTITION BY and ORDER BY) without collapsing them into a group
Reveal the answer + AI explanation — free account

23. Which term means: "an AQE feature that splits oversized skewed partitions into smaller sub-partitions so one task does not dominate a join"?

Senior
  1. A.Whole-stage code generation
  2. B.CTE
  3. C.Skew join optimization
  4. D.cost-based optimizer
Reveal the answer + AI explanation — free account

24. Which statement is correct?

Senior
  1. A.Skew join optimization — the tree of relational operators Spark builds and rewrites through analysis and optimization rules before producing physical plans
  2. B.Skew join optimization — an AQE feature that splits oversized skewed partitions into smaller sub-partitions so one task does not dominate a join
  3. C.Skew join optimization — a Common Table Expression, a named temporary result defined with WITH that improves readability and can be referenced multiple times in a query
  4. D.Skew join optimization — the executable plan of physical operators (chosen join strategies, exchanges) selected by Catalyst using cost and rules
Reveal the answer + AI explanation — free account

25. What does ANALYZE TABLE t COMPUTE STATISTICS do?

Mid
  1. A.the window expression assigning a unique sequential rank within each partition ordered by a column
  2. B.prints the parsed, analyzed, optimized, and physical plans for a query in a structured layout
  3. C.the DDL that defines a bucketed Spark table to enable shuffle-free joins on the bucket column
  4. D.collects table and column statistics so the cost-based optimizer can choose better plans
Reveal the answer + AI explanation — free account

26. Which command will collects table and column statistics so the cost-based optimizer can choose better plans?

Mid
  1. A.EXPLAIN FORMATTED
  2. B.ANALYZE TABLE t COMPUTE STATISTICS
  3. C.CREATE TABLE t (id INT) CLUSTERED BY (id) INTO 50 BUCKETS
  4. D.ANALYZE TABLE t COMPUTE STATISTICS FOR ALL COLUMNS
Reveal the answer + AI explanation — free account

27. Which statement is correct?

Mid
  1. A.ANALYZE TABLE t COMPUTE STATISTICS — collects table and column statistics so the cost-based optimizer can choose better plans
  2. B.ANALYZE TABLE t COMPUTE STATISTICS — the command that prints Spark's parsed, analyzed, optimized, and physical plans in a structured layout for tuning
  3. C.ANALYZE TABLE t COMPUTE STATISTICS — marks a DataFrame to be stored in memory on first action using the default MEMORY_AND_DISK storage level
  4. D.ANALYZE TABLE t COMPUTE STATISTICS — prints the parsed, analyzed, optimized, and physical plans for a query in a structured layout
Reveal the answer + AI explanation — free account

28. What does EXPLAIN FORMATTED do?

Mid
  1. A.prints the parsed, analyzed, optimized, and physical plans for a query in a structured layout
  2. B.the window expression assigning a unique sequential rank within each partition ordered by a column
  3. C.the Spark SQL command that gathers column-level statistics to feed the cost-based optimizer
  4. D.the DDL that defines a bucketed Spark table to enable shuffle-free joins on the bucket column
Reveal the answer + AI explanation — free account

29. Which command will prints the parsed, analyzed, optimized, and physical plans for a query in a structured layout?

Mid
  1. A.CREATE TABLE t (id INT) CLUSTERED BY (id) INTO 50 BUCKETS
  2. B.ANALYZE TABLE t COMPUTE STATISTICS FOR ALL COLUMNS
  3. C.ANALYZE TABLE t COMPUTE STATISTICS
  4. D.EXPLAIN FORMATTED
Reveal the answer + AI explanation — free account

30. Which statement is correct?

Mid
  1. A.EXPLAIN FORMATTED — prints the parsed, analyzed, optimized, and physical plans for a query in a structured layout
  2. B.EXPLAIN FORMATTED — the command that prints Spark's parsed, analyzed, optimized, and physical plans in a structured layout for tuning
  3. C.EXPLAIN FORMATTED — the DDL that defines a bucketed Spark table to enable shuffle-free joins on the bucket column
  4. D.EXPLAIN FORMATTED — the window expression assigning a unique sequential rank within each partition ordered by a column
Reveal the answer + AI explanation — free account

Showing 30 of 81 Spark SQL & Catalyst questions — the full set, with answers, explanations and an AI tutor on every question, is inside.

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Spark SQL & Catalyst free