fix(tests): make 3 allocation/consolidation tests compile on ClickHouse
Open-source Excel-native EPM and consolidation for SAP & Dynamics
Brought to you by:
konsolid-at
Originally created by: grynn-in
Fixes [#70].
Three data-tests errored at run time (ClickHouse exceptions) rather than validating anything:
| Test | Was | Fix |
|---|---|---|
assert_reciprocal_converges |
refs non-existent final_iteration (code 47) |
use step_order, the iteration column on gold_allocation_results |
assert_tier_total_equals_pool |
having sum(...) > max(...) read as nested aggregate (code 184) |
aggregate in a subquery, compare plain cols in outer WHERE |
assert_ownership_uses_effective_date |
date-range BETWEEN across both tables in JOIN ... ON (code 403) |
keep ON on equi-keys, move the range to WHERE (equivalent for INNER JOIN) |
dbt test --select assert_reciprocal_converges assert_tier_total_equals_pool assert_ownership_uses_effective_date
# Done. PASS=3 WARN=0 ERROR=0
tests/assert_dynamic_step_count.sql also fails, but as a genuine data assertion (Got 1 result, configured to fail if != 0), not a compile error — left for a separate look.
Originally posted by: grynn-in
Independent review — REQUEST-CHANGES (1 of 3)
#2 (
assert_tier_total_equals_pool) and [#3] (assert_ownership_uses_effective_date): correct. The HAVING→subquery+WHERE rewrite is semantically identical (same group keys, same aggregate comparison), and moving the date-range BETWEEN fromONtoWHEREis equivalent for an INNER JOIN (equi-keys stay in ON).#1 (
assert_reciprocal_converges):final_iteration→step_orderis semantically wrong.step_orderis the multistep cascade ordering (allocation_engine_multistep), not the reciprocal solver's iteration counter — that'sfinal_iteration, produced byallocation_engine_reciprocal(), which no model invokes.gold_allocation_resultsis built only by the multistep engine (step_down), so it has no reciprocal data and no iteration column. The swap makes the test compile and always pass — a false-green convergence guard, not a fix.Action: I'll disable this test with
{{ config(enabled=false) }}and a comment explaining it can't be evaluated until reciprocal output is materialized (keepingfinal_iterationas the intended column for when it is), rather than rewrite it to always-pass. Updating the PR.Related
Tickets:
#3Ticket changed by: grynn-in