Repository navigation
fix: support inline reductions mixed with measure refs and deferred-join totals (#314) - #321
Open
mathisdrn wants to merge 1 commit into
Conversation
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.
Fixes #314.
Problem
lambda t: t.amount.sum() / t.n) raisedIntegrityErrorbecauselift_inline_reductionsdid not rebind the virtual aggregate tables (vt_op,totals_vt_op) to include the lifted columns.t.all(...)totals on the deferred-join path (is_entityjoins) raisedTotalsNotAvailableErrorbecause_compile_deferred.pybypassed_compile_aggregation's windowed-totals handling and_find_deferrable_joinsdid not inspect calc measure dependencies / inline aggregates.Fix
vt_opandtotals_vt_opinlift_inline_reductionsand threadlifted_calc_specsthroughattach_calc_totalsinsrc/boring_semantic_layer/calc_compiler.py.known_measures | frozenset(lifted)andlifted_calc_specsin_compile_aggregation, inspect calc dependencies and inline aggregate callables in_find_deferrable_joins(src/boring_semantic_layer/ops/_core.py), and delegate deferred-join aggregation to_compile_aggregation(src/boring_semantic_layer/ops/_compile_deferred.py).src/boring_semantic_layer/tests/test_calc_compiler.pyandsrc/boring_semantic_layer/tests/test_deferred_join.py.Verification
ruff check .andruff format --check .passed..venv/bin/pytest -q src/boring_semantic_layer/tests/test_calc_compiler.py src/boring_semantic_layer/tests/test_deferred_join.py src/boring_semantic_layer/tests/soundness/test_calc_window_totals.py src/boring_semantic_layer/tests/test_import_graph.py: 48 passed.