Skip to content

Use effective family parameters for sketch measure identity - #2597

Merged
robinld merged 7 commits into
DataJunction:mainfrom
robinld:robind/normalize-sketch-family-params
Oct 9, 2026
Merged

robinld merged 7 commits into
DataJunction:mainfrom
robinld:robind/normalize-sketch-family-params

Conversation

@robinld

@robinld robinld commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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.

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 475230d
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6ac7f589cde859000860fc0b

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Changes how sketch measure identity is computed in decomposition.

The PR should not merge until existing default-parameter frozen measures can be reused during metric redeployment.

Findings

  1. P1 Existing sketch measures cannot be reused ▶

Summary

The PR stores a family decomposition’s effective parameters on extracted sketch components so equivalent declarations have the same measure identity.

  • Adds a regression test for omitted, integer, and integer-valued-float defaults.
  • Existing frozen measures created with omitted parameters need compatibility handling before the new identity can be used safely.

Reviews (1) · Last reviewed commit: "Use effective family parameters for sket..."

Comment thread datajunction-server/datajunction_server/sql/decompose.py Outdated
@datajunction-gh

datajunction-gh Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

AI Review

Summary

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:1915 Previously 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.

@datajunction-gh datajunction-gh Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataJunction deep review of b4c10c475dc26fe2af9150d5c11562e7bba136e1. Maintained summary includes off-diff findings. Advisory only.

Comment thread datajunction-server/datajunction_server/sql/decompose.py Outdated
@robinld
robinld requested a review from betodealmeida October 5, 2026 18:02
@robinld
robinld requested a review from shangyian October 8, 2026 19:57
@robinld
robinld merged commit 68e3c9e into DataJunction:main Oct 9, 2026
27 checks passed
@robinld
robinld deleted the robind/normalize-sketch-family-params branch October 9, 2026 05:45
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.

2 participants