ClickHouse / dbt-clickhouse

The Clickhouse plugin for dbt (data build tool)
Apache License 2.0
257 stars 114 forks source link

Fix bool_or behavior #270

Closed scrawfor closed 7 months ago

scrawfor commented 7 months ago

Summary

No issue created, but I can open one if needed.

This fixes an issue with the cross-database dbt macro bool_or. It was using any which selects the first non-null column value. This means it can return false even if there is a true in the same group. Updated the function to use the max function instead.

Example:

with my_test_values as (
   select false as val
   union all 
   select true
   union all
   select null
)

select any(val), max(val)
from my_test_values
any(val) max(val)
false true

Checklist

Delete items not relevant to your PR:

CLAassistant commented 7 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.