DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #92
Which of the following DataFrame operations is classified as a transformation?
The correct answer is A. DataFrame.select(). In Spark, operations are classified as either transformations (lazy, return a new DataFrame) or actions (eager, trigger computation and return a result). DataFrame.select() is a transformation - it describes a new DataFrame derived from the original but does not execute until…
Question
Which of the following DataFrame operations is classified as a transformation?
Options
- ADataFrame.select()
- BDataFrame.count()
- CDataFrame.show()
- DDataFrame.first()
- EDataFrame.collect()
How the community answered
(27 responses)- A93% (25)
- B4% (1)
- D4% (1)
Explanation
In Spark, operations are classified as either transformations (lazy, return a new DataFrame) or actions (eager, trigger computation and return a result). DataFrame.select() is a transformation - it describes a new DataFrame derived from the original but does not execute until an action is called. The other options are all actions: count() returns a Long, show() prints rows to the console, first() returns the first Row, and collect() returns all rows as an array to the driver. Actions trigger the execution of the entire DAG of transformations built up to that point.
Topics
Community Discussion
No community discussion yet for this question.