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
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?
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
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
0
0
0
10
Comments
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.
Report Comment
Commenting
You can sign-up / login (it's free).