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 100 discussion

The code block shown below contains an error. The code block is intended to return the exact number of distinct values in column division in DataFrame storesDF. Identify the error.

Code block:

storesDF.agg(approx_count_distinct(col(“division”)).alias(“divisionDistinct”))

  • A. The approx_count_distinct() operation needs a second argument to set the rsd parameter to ensure it returns the exact number of distinct values.
  • B. There is no alias() operation for the approx_count_distinct() operation's output.
  • C. There is no way to return an exact distinct number in Spark because the data Is distributed across partitions.
  • D. The approx_count_distinct()operation is not a standalone function - it should be used as a method from a Column object.
  • E. The approx_count_distinct() operation cannot determine an exact number of distinct values in a column.
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
bp_a_user
3 weeks, 1 day ago
Selected Answer: A
I can write approx_count_distinct("value",0)
upvoted 1 times
bp_a_user
3 weeks, 1 day ago
I correct myself: min value is 3.4E-5 --> so not possible!
upvoted 1 times
...
...
azure_bimonster
6 months ago
Selected Answer: E
storesDF.agg(countDistinct("division").alias("divisionDistinct")) can give an exact distinct value unlike E option
upvoted 1 times
...
thanab
10 months, 4 weeks ago
E The error in the code block is that the approx_count_distinct() operation cannot determine an exact number of distinct values in a column.
upvoted 1 times
...
Ram459
11 months, 3 weeks ago
Selected Answer: E
can not get exact distinct using apox function
upvoted 3 times
newusername
9 months ago
agree, should be E
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago