nerdexam
Databricks

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…

Working with Spark DataFrames

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)
  • A
    93% (25)
  • B
    4% (1)
  • D
    4% (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

#Spark DataFrames#Transformations#Actions#Spark API

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice