Question of the day · Databricks
Databricks Certified Data Engineer Professional: today's question
Today · Developing Code for Data Processing using Python and SQL
A unit test calls assertDataFrameEqual(actual, expected, checkRowOrder=True) on the output of a groupBy().agg() transformation. It passes on a laptop but fails intermittently in CI, always with the same rows in a different order. Row order is not part of the function's contract. What should the engineer change?
- AAdd
ignoreColumnOrder=Trueso that the comparison no longer depends on how the rows are ordered - BRaise
rtolso that rows that differ only in their position are treated as approximately equal - CCall
actual.coalesce(1)before the assertion so that Spark returns the rows in insertion order - DDrop
checkRowOrder=True; by default rows are compared regardless of their order
Show the answer
D. assertDataFrameEqual defaults to checkRowOrder=False, which compares rows as a multiset. Spark doesn't guarantee row order after a shuffle such as an aggregation, so forcing an order check on unsorted output makes a correct test flaky.
Written for practice in the style of the exam: never a question from the real exam. A new one every day.
Want ten more now?
The free readiness check asks ten questions weighted like the real exam and shows your score by section.