github-actions[bot] commented on code in PR #63763:
URL: https://github.com/apache/doris/pull/63763#discussion_r3611802226
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java:
##########
@@ -1100,6 +1099,36 @@ public void computeFd(DataTrait.Builder builder) {
}
}
+ /**
+ * Whether the scan is configured with a session variable that makes
+ * the BE return potentially duplicate rows even for declared unique
+ * keys. In these modes any uniqueness guarantee — whether from OLAP
+ * key metadata or from user-declared PRIMARY KEY / UNIQUE constraints
+ * — is unreliable.
+ */
+ private boolean isDuplicateProducingScanMode() {
+ SessionVariable sv = ConnectContext.get().getSessionVariable();
Review Comment:
[P1] Suppress uniqueness for incremental row-binlog scans
The new gate covers the three session flags from the prior thread, but it
still returns false for `LogicalOlapTableStreamScan(INCREMENTAL)` and
`scanParams.incrementalRead()`.
```text
Filter(2 * f.v > scalar)
Apply(correlation = s.id)
CrossJoin(Scan fact f, MIN_DELTA stream s) -- two s.id=1 change rows
Aggregate(SUM(f2.v))
Filter(f2.id = s.id)
Scan fact f2
```
`OlapTableStreamWrapper` inherits the base UNIQUE key, and WinMagic runs
before stream normalization, so this becomes `SUM(f.v) OVER (PARTITION BY
s.id)`. With one `f.v=10`, the original evaluates `20 > 10` independently for
both stream rows, while the window sees both copies and evaluates `20 > 20`,
returning none. Please suppress all uniqueness sources for incremental
stream/row-binlog scans and add negative rewrite coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]