Conversation
fornwall
force-pushed
the
order-independent-comparison
branch
from
September 12, 2026 10:36
1d9f7fe to
4fe8efa
Compare
fornwall
marked this pull request as draft
September 12, 2026 10:58
fornwall
force-pushed
the
order-independent-comparison
branch
from
September 12, 2026 11:22
4fe8efa to
0f20379
Compare
fornwall
force-pushed
the
order-independent-comparison
branch
from
September 12, 2026 11:57
0f20379 to
8f35396
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unit tests compare the model's actual rows with the expected fixture. The comparator previously matched rows by their returned positions, so identical results could fail when the warehouse returned them in different orders.
BigQuery
ARRAYandSTRUCT(and soon perhapsGEOGRAPHYandJSON) columns are excluded from the generatedORDER BY(as it's unsupported).ORDER BY.For example, this model returns 100 STRUCT rows:
A unit test supplies the same rows in reverse order:
When BigQuery returns actual IDs
1…100and expected IDs100…1, the old comparator reports:With this fix, the same test passes. Complete typed rows are matched independently of their returned order, consuming each expected occurrence once. Adding a constant
1 AS sort_keyto both the model and fixture also passes, even though the generatedORDER BY sort_keyleaves all rows tied.Duplicate counts still matter. If the expected fixture replaces ID 100 with another ID 99, there are still 100 rows on each side, but the test correctly fails with:
Matching uses Arrow row encoding where supported and recursive typed comparison otherwise.
{a: 1, b: 2}matches{b: 2, a: 1}.[1, 2]differs from[2, 1].Related: dbt-labs#14110, dbt-labs#13988, dbt-labs#10167.