Noos
PT EN
RAN-DBDEA-00048
Ranvier · DBDEA

Exam DBDEA Topics: transformation Difficulty: easy

A daily gold KPI reports distinct visitors per date over roughly 800 million events. The exact query below runs for about 25 minutes because counting distinct values forces a massive shuffle to bring all values of each key together: ```sql SELECT event_date, count(DISTINCT visitor_id) AS visitors FROM catalog.web.silver_events GROUP BY event_date; ``` The dashboard tolerates an error of a few percent in exchange for a much faster query. Which function should replace count(DISTINCT ...)?

Options (Reading Mode) Click to filter discussion →
  1. A. count(visitor_id) — counting non-null rows is statistically equivalent to counting unique visitors
  2. B. size(collect_set(visitor_id)) — collecting the exact set of visitors per date
  3. C. approx_count_distinct(visitor_id) — a sketch-based approximate distinct count with far less shuffling
  4. D. percentile_approx(visitor_id, 0.5) — the approximate median visitor id
Reveal answer

Correct answer: approx_count_distinct(visitor_id) — a sketch-based approximate distinct count with far less shuffling

Reference: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-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 (C): approx_count_distinct(visitor_id) — a sketch-based approximate distinct count with far less shuffling

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.