Repository navigation
Fix #1141: Skip hierarchical rules where their condition is not true on DuckDB - #1144
Open
albertohernandez1995 wants to merge 1 commit into
Open
albertohernandez1995 wants to merge 1 commit into
albertohernandez1995 wants to merge 1 commit into
Conversation
2 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On DuckDB, a hierarchical rule whose
whencondition was FALSE still produced a data point:check_hierarchy(all/all_measures) returned one withbool_varTRUE and a nullimbalance, andhierarchyreturned 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
rulefell back to the dataset value. The pivot now treats the item as missing wherever the rule produced no data point, as the inputruledefinition 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
ruff format,ruff check,mypy): mypy's 3 errors inModel/__init__.pyare already on1.9.X, not from this changepytest)Impact / Risk
check_hierarchyall/all_measuresno longer return data points for rules whose condition is FALSE,hierarchyno longer returns null values for them, and with inputrulea computed code item no longer falls back to its dataset value where its rule produced nothing.whencondition only produce data points where the condition is TRUE, matching the pandas engine.Closes #1141