You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use effective family parameters for sketch measure identity - #2597
A t-digest metric that omits compression uses the default value of 200. Another metric can explicitly set compression to 200. Both generate the same sketch and the same component name.
Today, the first component is recorded with no parameters, while the second is recorded with compression=200. When the second metric tries to reuse the existing frozen measure, OSS rejects it because the recorded parameters differ.
Change
Let a registered family decomposition canonicalize parameters before OSS records them on a component. The t-digest implementation can treat an explicit default of 200 as no stored parameter, so it matches the existing sketch. A non-default value such as 500 remains distinct.
Metrics that already use an omitted default keep their existing empty-parameter identity.
Tests
The new regression test checks that omitted, integer, and integer-valued-float defaults produce the same component name and parameter identity. Local checks: 12 family-decomposition tests and 51 frozen-measure/preaggregation tests passed.
The PR makes omitted and explicit-default sketch parameters share a component identity and adds compatibility for frozen measures and query-time preaggregation matching. Persistence lookups still use raw identities, so redeploying a legacy explicit-default external preaggregation can remove its available row. This upgrade path blocks approval.
Findings
❌ datajunction-server/datajunction_server/sql/decompose.py:1915Previously resolved thread; issue still present. Canonicalizing an explicit compression=200 to params=None changes the token passed by external registration, but PreAggregation.find_matching still compares it literally with a pre-upgrade row storing {"compression": 200}. On an unchanged redeploy, registration inserts a new row instead of reusing the available one. With no freshness supplied, find_latest_for_node makes the same literal comparison and cannot inherit availability; deployment reconciliation then deletes the old row because its ID was not upserted. The valid table disappears from query routing. Apply legacy-default equivalence to both persistence lookups without changing the stored hash or physical-table reference, and test redeploy and parent-revision rollover from an explicit-default row.
Tests
⚠️ Redeploy an unchanged external preaggregation stored with compression=200 and verify its row, availability, and query routing survive.
⚠️ Verify availability survives a parent-revision rollover and planning does not create a duplicate for the legacy measure.
Missing context / blind spots
⚠️ Focused tests could not run because pytest and SQLAlchemy are unavailable in this runtime.
⚠️ The production t-digest family implementation is outside this checkout, so its compression-200 canonicalization was not independently verified.
Final Verdict
Status: ❌ Block — do not approve
Minimum required actions:
Make preaggregation upsert and predecessor lookups recognize legacy explicit-default measures while preserving existing hashes and physical-table references.
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
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.
Problem
A t-digest metric that omits compression uses the default value of 200. Another metric can explicitly set compression to 200. Both generate the same sketch and the same component name.
Today, the first component is recorded with no parameters, while the second is recorded with compression=200. When the second metric tries to reuse the existing frozen measure, OSS rejects it because the recorded parameters differ.
Change
Let a registered family decomposition canonicalize parameters before OSS records them on a component. The t-digest implementation can treat an explicit default of 200 as no stored parameter, so it matches the existing sketch. A non-default value such as 500 remains distinct.
Metrics that already use an omitted default keep their existing empty-parameter identity.
Tests
The new regression test checks that omitted, integer, and integer-valued-float defaults produce the same component name and parameter identity. Local checks: 12 family-decomposition tests and 51 frozen-measure/preaggregation tests passed.