The problem I’m having
I am getting inconsistently failing unit tests because the arrays in my results are not ordered.
The context of why I’m trying to do this
I’m using dbt to run unit tests on models against Apache Spark. My model has arrays in the results, I don’t care about the ordering of the arrays and for performance reasons I’d like to avoid sorting my arrays in my model.
What I’ve already tried
Normally I’d configure my unit test to sort the values after running my system under test and compare the sorted results, essentially eliminating order from the expected result but I can’t see any way to do this with dbt unit testing.
I tried making a view that just sorts the arrays but it just complains that I haven’t set the values of the upstream tables so this failed because I am unable to have my unit test depend on the actual parent(s).