Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 134 discussion

The code block shown below contains an error. The code block is intended to return a new DataFrame from DataFrame storesDF where column storeId is of the type string. Identify the error.

Code block:

storesDF.withColumn(“storeId”, cast(col(“storeId”), StringType()))

  • A. Calls to withColumn() cannot create a new column of the same name on which it is operating.
  • B. DataFrame columns cannot be converted to a new type inside of a call to withColumn().
  • C. The call to StringType should not be followed by parentheses.
  • D. The column name storeId inside the col() operation should not be quoted.
  • E. The cast() operation is a method in the Column class rather than a standalone function.
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
JuanitoFM
9 months ago
Selected Answer: E
https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.Column.cast.html?highlight=cast
upvoted 1 times
...
azure_bimonster
9 months, 2 weeks ago
Selected Answer: E
E is the right
upvoted 1 times
...
Anweee
9 months, 3 weeks ago
It is E, no doubt about it
upvoted 1 times
...
gowthamsara
10 months, 2 weeks ago
Selected Answer: E
E should be the answer
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.

SaveCancel
Loading ...