Exam Associate-Developer-Apache-Spark-3.5 Topic 1 Question 16 Discussion

Actual exam question for Databricks's Associate-Developer-Apache-Spark-3.5 exam
Question #: 16
Topic #: 1
An engineer has a large ORC file located at/file/test_data.orcand wants to read only specific columns to reduce memory usage.
Which code fragment will select the columns, i.e.,col1,col2, during the reading process?

Suggested Answer: D Vote an answer

Comprehensive and Detailed Explanation From Exact Extract:
The correct way to load specific columns from an ORC file is to first load the file using.load()and then apply.
select()on the resulting DataFrame. This is valid with.read.format("orc")or the shortcut.read.orc().
df = spark.read.format("orc").load("/file/test_data.orc").select("col1","col2") Why others are incorrect:
Aperforms selection after filtering, but doesn't match the intention to minimize memory at load.
Bincorrectly tries to use.select()before.load(), which is invalid.
Cuses a non-existent.selected()method.
Dcorrectly loads and then selects.
Reference:Apache Spark SQL API - ORC Format

by Stephanie at Oct 14, 2026, 09:19 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10