Check Your Knowledge
Test your understanding of this section’s pattern translations before moving on.
- Why is a cursor loop translated as
for row in df.collect(): ...considered an anti-pattern?- A.
collect()is deprecated in current Spark versions - B. It pulls the entire DataFrame to the driver, discarding distributed execution and risking out-of-memory failures
- C. Python for-loops cannot iterate over Spark DataFrames at all
- D. It requires a paid Databricks license feature
- A.
- Which cursor pattern maps directly to a window function like
SUM(...) OVER (ORDER BY ...)?- A. A per-row external API call
- B. A running accumulation or running total maintained across rows in order
- C. A cursor that never reads any rows
- D. A cursor used only for logging
- What replaces an Oracle row-level trigger on Databricks, since Delta tables don’t execute code on write?
- A. A second trigger defined on the same table
- B. Delta Change Data Feed, consumed explicitly via
table_changes()orreadChangeFeed - C. A stored procedure called manually after every write
- D. There is no replacement; triggers cannot be migrated
- What is the main advantage of Lakeflow Jobs over
DBMS_SCHEDULERhighlighted in this section?- A. Lakeflow Jobs run faster in all cases
- B. Scheduling, retries, and dependencies are declared visibly and every run produces a queryable history
- C. Lakeflow Jobs don’t require any configuration
- D. DBMS_SCHEDULER cannot run PL/SQL code
- When should a session temp table be translated into a CTE rather than a persisted Declarative Pipeline table?
- A. Always – CTEs should replace every temp table
- B. When the intermediate result is used once, immediately, and never inspected independently
- C. When the intermediate result is shared across many downstream steps
- D. Never – CTEs are not supported on Databricks
- What does Delta’s
MERGE INTOdo differently from Oracle’sMERGEwhen the join condition matches more than one source row to a target row?- A. It silently picks the first matching row
- B. It throws an error rather than applying a nondeterministic update
- C. It ignores the match entirely
- D. It automatically deduplicates the source table
- Which clause does Delta’s
MERGE INTOsupport that Oracle’sMERGEdoes not have a direct equivalent for?- A.
WHEN MATCHED - B.
WHEN NOT MATCHED - C.
WHEN NOT MATCHED BY SOURCE - D.
USING
- A.
- What parameter does
create_auto_cdc_flowuse to correctly handle late-arriving or out-of-order change records in an SCD Type 2 flow?- A.
keys - B.
target - C.
sequence_by - D.
stored_as_scd_type
- A.
- Why is unconditionally materializing every temp table as its own persisted Declarative Pipeline table listed as an anti-pattern?
- A. Declarative Pipelines don’t support persisted tables
- B. It inflates storage and pipeline DAG complexity with nodes that add no value for single-use staging
- C. It’s illegal under Unity Catalog governance rules
- D. It causes MERGE statements to fail
- What do all five anti-patterns in the gallery have in common?
- A. They all involve syntax errors that fail immediately
- B. They preserve the legacy code’s literal shape instead of its intent, and fail only at production scale or under real-world conditions
- C. They only affect tables smaller than one gigabyte
- D. They are all related to Unity Catalog permissions
Answer Key
- B –
collect()brings all rows to the driver, defeating distributed execution and risking out-of-memory errors at real data volume. - B – A running total or accumulation walked in row order is exactly what a window function computes without any loop.
- B – Delta tables don’t execute code on write, so Change Data Feed makes row-level changes queryable explicitly instead.
- B – Lakeflow Jobs make scheduling, retries, and dependencies visible in the job definition and produce a queryable run history.
- B – A single-use, immediately-consumed intermediate result doesn’t need persisted storage; a CTE computes it inline.
- B – Delta’s
MERGE INTOrejects ambiguous matches with an error instead of silently applying a nondeterministic update. - C –
WHEN NOT MATCHED BY SOURCEhandles target rows with no matching source row, a clause Oracle’sMERGElacks directly. - C –
sequence_bytells the AUTO CDC flow which column determines correct ordering, handling out-of-order arrivals correctly. - B – Materializing single-use staging as a persisted table adds storage and DAG nodes that provide no benefit over a CTE.
- B – Each anti-pattern compiles and runs but preserves the legacy shape rather than the intent, failing only at production scale or under real arrival conditions.
| ← Previous: Anti-Pattern Gallery and Pattern Cheat Sheet | Next: AI-Assisted Migration: Lakebridge plus LLMs With a Human Gate → | |:—|—:|