Styxis
Company
Knowledge

Preserve OFFSET semantics through a wrapped Doris correlated subquery

Reconcile parent keys for the correlated OFFSET case using the reachable wrapper and exact build. An analyzer rejection of the top-level query is not a reproduction of an incorrect result.

OFFSET changes matching cardinality

OFFSET changes the number of matches needed by correlated EXISTS. It cannot be discarded by an unrestricted limit-elimination rule. Truthound Core can compare exported parent keys with an independently derived matching-count reference. [1, 2, 3]

The corrected reachable path

Doris issue #69490 was qualified in follow-ups: the initial top-level SQL is rejected or folded by analyzer checks. The reporter then supplies a derived-table wrapper reproduced on doris-4.1.3-rc02-7126cf65d96. The source does not recommend disabling the rule as a workaround because another fallback appears. [1]

Preserve the wrapped query

Use the wrapped correlated EXISTS shape and independently count children for each parent at the same snapshot. Retain build and rewritten-plan evidence. Do not count a protected top-level rejection as a wrong-result reproduction. [1, 3]

Only parent 1 has a second child

Parent 1 has children 100 and 200; parent 2 has only 300. LIMIT 1 OFFSET 1 leaves a child only for parent 1, so expected set=1. Set 1 passes; 1|2 fails because it admits a parent with only one match. [1, 3]

Check sets after SQL reachability

DistinctValuesEqualSetValidator in Truthound Core Python SDK 3.3.2 compares the prepared result key column with expected_values. The operator establishes query reachability and the reference. The SDK does not modify the optimizer or certify untested releases. [1, 2, 3]

Use the semantic COUNT reference

Compare the wrapped query with a semantic COUNT>1 reference. Keep IN top-row selection as a separate contract and do not suggest a disabled-rule path as verified recovery. [1, 3]

The correction narrows the claim

The correction changes the diagnosis scope, not the meaning of OFFSET. Preserving the reachable wrapper and exact reported build makes the example useful without repeating the original overbroad SQL claim. [1, 3]

Application conditions

Prepare the fixed-build derived-table wrapper and independent child counts per parent.

Alternatives

Compare the wrapped query with a COUNT>1 semantic reference at the same snapshot.

Limitations

  • Initial top-level SQL is protected, and disabling the rule is not a verified workaround.

Evidence

Event checked
Subject checked
Modified