calogica / dbt-expectations

Port(ish) of Great Expectations to dbt test macros

Home Page:https://calogica.github.io/dbt-expectations/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] expect_column_values_to_be_null should succeed for empty arrays

ilkernator opened this issue · comments

Is your feature request related to a problem? Please describe.
I'm currently leveraging dbt-expectations in a project that is supposed to compile Hive queries. However, in many cases, when there is a column of type 'array' or 'struct(array)', the expect_column_values_to_be_null.sql-test can be misleading as the array could be simply "empty", i.e. '[ ]', '[" "]', ...

Describe the solution you'd like
I've created two very basic "column_values_basic" macros in my project that work just perfectly. Basically, I'm using the array_contains() and the size(). Hive functions to assert the column is empty. So I wanted to share this with the community.

Describe alternatives you've considered
I haven't thought about an alternative to be honest, as the need was there for me. However, I tried to keep the new tests as simple as possible.

Additional context
n.a.

Thanks for sharing this. FYI, we don't support hive and have no plans to add support for hive in the future.