Noos
PT EN
RAN-DBDEA-00211
Ranvier · DBDEA

Exam DBDEA Topics: transformation Difficulty: medium

A daily consolidation reads two regional extracts into DataFrames. Both extracts carry the same four columns — order_id, order_date, amount, region — but the EU file delivers them in a different column order than the US file. The combined output must pair every column with its correct data regardless of the position in which each file lists it. How should the engineer stack the two DataFrames?

Options (Reading Mode) Click to filter discussion →
  1. A. eu.union(us) — union() resolves columns by name automatically whenever the two schemas differ in column position
  2. B. Reorder one DataFrame with an explicit select() first — manually aligning the column positions is the only safe way to combine the extracts
  3. C. It cannot be done — Spark refuses to combine DataFrames whose columns are not declared in the same order
  4. D. eu.unionByName(us) — it pairs columns by name between the two DataFrames, so position differences cannot mismatch the data
Reveal answer

Correct answer: eu.unionByName(us) — it pairs columns by name between the two DataFrames, so position differences cannot mismatch the data

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

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 (D): eu.unionByName(us) — it pairs columns by name between the two DataFrames, so position differences cannot mismatch the data

⚓ Official Documentation Anchor: https://docs.databricks.com/aws/en/pyspark/reference
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.