Skip to content

Fix #1141: Skip hierarchical rules where their condition is not true on DuckDB - #1144

Open
albertohernandez1995 wants to merge 1 commit into
1.9.Xfrom
cr-1141
Open

albertohernandez1995 wants to merge 1 commit into
1.9.Xfrom
cr-1141

Conversation

@albertohernandez1995

Copy link
Copy Markdown
Contributor

Summary

On DuckDB, a hierarchical rule whose when condition was FALSE still produced a data point: check_hierarchy (all / all_measures) returned one with bool_var TRUE and a null imbalance, and hierarchy returned a null computed value. Following the VTL 2.2 Hierarchical rulesets page ("the Antecedent Condition is evaluated and, if true, the operations ... are performed"), the rule now only applies where its condition is TRUE, in every output and mode, which is what the pandas engine already returned.

Without that null row, a later rule reading the computed code item under input rule fell back to the dataset value. The pivot now treats the item as missing wherever the rule produced no data point, as the input rule definition says, which also aligns DuckDB with pandas for chained rules whose mode filter drops a data point.

Added tests GH_1141_1–GH_1141_4.

Checklist

  • Code quality checks pass (ruff format, ruff check, mypy): mypy's 3 errors in Model/__init__.py are already on 1.9.X, not from this change
  • Tests pass (pytest)
  • Documentation updated (if applicable)

Impact / Risk

  • Breaking changes? DuckDB engine only: check_hierarchy all / all_measures no longer return data points for rules whose condition is FALSE, hierarchy no longer returns null values for them, and with input rule a computed code item no longer falls back to its dataset value where its rule produced nothing.
  • Data/SDMX compatibility concerns? None.
  • Notes for release/changelog? DuckDB engine: hierarchical rules with a when condition only produce data points where the condition is TRUE, matching the pandas engine.

Closes #1141

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Engines differ on check_hierarchy all for data points where a rule's condition is FALSE

1 participant