Noos
PT EN
RAN-DBDEA-00046
Ranvier · DBDEA

Exam DBDEA Topics: transformation Difficulty: hard

bronze_orders accumulates re-delivered files: the same order_id appears multiple times with different ingested_at values, and silver must keep exactly the most recent row per order. A teammate proposes: ```python from pyspark.sql.functions import col latest = (bronze .orderBy(col("ingested_at").desc()) .dropDuplicates(["order_id"])) ``` What is the correct assessment of this proposal?

Options (Reading Mode) Click to filter discussion →
  1. A. The proposal is correct — orderBy(col('ingested_at').desc()) guarantees that dropDuplicates(['order_id']) keeps the newest row per order, because the sort carries over
  2. B. dropDuplicates(['order_id']) keeps an arbitrary row, ignoring the sort — use row_number() over a window ordered by ingested_at DESC, keeping rn = 1
  3. C. dropDuplicates(['order_id']) is missing columns — listing every column of the table would make it keep only the latest row
  4. D. Replace dropDuplicates(['order_id']) with distinct(), which keeps the last row encountered after an orderBy
Reveal answer

Correct answer: dropDuplicates(['order_id']) keeps an arbitrary row, ignoring the sort — use row_number() over a window ordered by ingested_at DESC, keeping rn = 1

Reference: https://docs.databricks.com/aws/en/pyspark/reference/functions

02 — The Myelin Layer · Canonical Discussion

Where the exam tries to trick you — and how those who passed solved it.

0 Passed

contributed to this question

Answer Distractor Matrix Click an option to filter or open its dissection.
✦ Consolidated Synthesis (Wiki) rev. #1 (baseline) · CC BY-SA 4.0
Start synthesis for this question →

No community synthesis consolidated for this question yet. Below is the verifiable official starting point — if you passed the exam, open the option dissection.

Official Answer (B): dropDuplicates(['order_id']) keeps an arbitrary row, ignoring the sort — use row_number() over a window ordered by ingested_at DESC, keeping rn = 1

Ranvier · DBDEA

Contribute to this Question

Your contribution builds your Orbital Sheath

Peer contributions

No public contribution yet. Be the first who passed to explain why the distractors trick candidates — your contribution builds your Orbital Sheath.