test(tesseract): pin the row set of a share whose denominator drops the query filter - #11822
test(tesseract): pin the row set of a share whose denominator drops the query filter#11822waralexrom wants to merge 3 commits into
Conversation
|
Claude finished @waralexrom's task in 2m 27s —— View job Review: tests-only change, snapshot values check out against the seed — 0 high, 0 medium, 3 low (all nits, posted inline)Full review
What I verifiedBoth snapshots are arithmetically consistent with
That is the right pin: the share reflects a denominator that ignores the The two cases are genuinely distinct, not a copy: with the grain intersected down to nothing the widened key grid collapses to one row, so only the keys side inheriting the wrong state is observable; keeping Structure follows the file's existing convention exactly ( Findings (all low, inline)
None of these affect correctness; the change is mergeable as-is. What I could not doI could not run The full-join coverage gap called out under "Risks" is real but correctly scoped out: the denominator CTE carries an explicit keys side, so the keys strategy is selected on every dialect and the untested full-join assembly is not on this path. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11822 +/- ##
===========================================
+ Coverage 60.16% 80.30% +20.13%
===========================================
Files 239 500 +261
Lines 19206 106357 +87151
Branches 3886 3886
===========================================
+ Hits 11556 85411 +73855
- Misses 7100 20396 +13296
Partials 550 550
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…outside the query grain A multi-stage denominator can combine `group_by` naming only members the query does not group by with `filter: exclude` dropping the query's own filter. The grain intersection then leaves the measure side with no query dimension at all while its aggregation input spans the values the query filtered out, so the reported rows can only come from the keys side. Covers the shape end to end on Postgres: the query row set and the share value. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…hape The first case leaves the intersection empty, so the widened key grid is a single row and only the keys side inheriting the wrong state can be observed. Keeping the query's time dimension in the partition makes the grid non-empty, so a widened row set shows up directly as the filtered-out statuses coming back per month. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ew cases Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
a43199e to
0b274c8
Compare
|
Claude finished @waralexrom's task in 1m 14s —— View job Re-review after the latest push: previous nits addressed, no new findings — 0 high, 0 medium, 1 low (a prior naming nit, still open)Full review
What changed since the last round
The current fixture addition is 17 lines with no prose, and the two tests carry no preamble — consistent with the leaner measures in the same block. Re-verified against the seedBoth snapshots still line up with
The pin is still the right one: the denominator ignores the Also re-confirmed: neither new measure is in FindingsOne low, from the previous round, still applicable and left unresolved (thread on What I could not do
Mergeable as-is. |
Problem
Reported: a multi-stage share measure whose denominator carries
group_bynamingmembers outside the query grain, together with
filter: excludedropping thequery's own filter, returned extra rows with a NULL share — the values the query
filtered out came back alongside the real row.
Cause
The denominator is a sum-of-sum aggregate, so it is eligible for the window path.
That path has one row set serving both the aggregation input and the reported
rows, so once
filter.excludewidens the input, the widened rows are reportedtoo.
The planner already revokes the window path when a filter directive drops a
filter the query restricts the grid by, and that revocation is what saves this
shape — the reported query returns the correct single row on current master.
What was missing is a test: this shape differs from the covered ones in that
group_byintersects the query grain rather than extending it, so the measureside can end up keeping none of the query's dimensions and the reported rows can
only come from the keys side.
What changed
Tests only. No production code changes.
integration_multi_stage.yaml: a denominator partitioned bycategory/created_at/created_at.daywhosefilter.excludedrops the query filteron
status, plus a share measure consuming it.filter_directive.rs: two integration tests over that measure — one where thepartition intersects the query grain down to nothing, one where the query's
time dimension survives the intersection so the widened key grid is non-empty.
How it was verified
Both tests pass on master and fail when the window-path revocation is disabled,
reproducing the report verbatim — the filtered-out statuses come back carrying
NULL:
and, in the partially-kept case, once per month:
The reported model and query were also run end-to-end through the JS schema
compiler against Postgres on both planners. Tesseract returns the single
expected row. The legacy planner returns the same single row with the
denominator still filtered (share = 1.0), because the
filter:directive isTesseract-only — a documented difference, not a regression.
Full
cubesqlplannersuite green with--features integration-postgres(1374 passed). CI covers these snapshots:
push.ymlruns--features cubesqlplanner/integration-cubestore, which impliesintegration-postgres.Risks
Low — the diff adds two tests and two measures to a shared test fixture. The new
measures are not exported by any view in that fixture, so no existing test
changes shape.
Known coverage gap, not addressed here:
tesseract/join_types_fullis definedonly by the Snowflake dialect, so the full-join assembly strategy has no test
coverage at all. Postgres rejects that join shape at every version ("FULL JOIN is
only supported with merge-joinable or hash-joinable join conditions"), so it
cannot be row-validated in the existing harness. It does not affect this shape:
the denominator CTE carries an explicit keys side, which selects the keys
strategy on every dialect.
🤖 Generated with Claude Code