You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "MartijnVisser (via GitHub)" <gi...@apache.org> on 2026/10/02 13:59:41 UTC
[PR] [FLINK-28737][table-planner] Check Calc filter on updating input in the NDU analyzer [flink]
MartijnVisser opened a new pull request, #29367:
URL: https://github.com/apache/flink/pull/29367
## What is the purpose of the change
- `visitCalc` skips the condition once the input's upsert key satisfies the required determinism, so `WHERE b > UNIX_TIMESTAMP() - 300` on a CDC table into a sink keyed on that key passes `TRY_RESOLVE` without advice, the retraction can be dropped and the sink keeps the stale row. The condition is now checked whenever the input has updates, as `visitJoin` does.
- Dropping the upsert key in `FlinkRelMdUpsertKeys` instead would fail such queries on the `ON CONFLICT` validation in the default `IGNORE` mode, change compiled plans and still miss a Calc below `ChangelogNormalize`.
## Brief change log
- `visitCalc` checks the condition also when the required determinism is empty; `visitCorrelate` keeps its early return, a Correlate output never carries an upsert key
- `NonDeterministicDagTest#testCdcWithNonDeterministicFilter` expects the error under `TRY_RESOLVE`
- `NonDeterministicUpdateAnalyzerTest`: a `PLAN_ADVICE` case for the same query, five `TRY_RESOLVE` cases for other Calc placements, one deterministic control
- one paragraph in `determinism.md` (EN and ZH)
## Verifying this change
This change added tests and can be verified as follows:
- the changed Scala case and the six new cases fail on the base commit and pass with the fix, no plan changes under `IGNORE`
- a runtime probe with a filter UDF that is true on its first call only keeps the deleted row in the sink under `IGNORE`, `TRY_RESOLVE` now rejects the statement
- no `SemanticTestBase` program, `FailingSqlTestStep` only accepts `ValidationException` or `TableRuntimeException`
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Fable 5.1)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-28737][table-planner] Check Calc filter on updating input in the NDU analyzer [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29367:
URL: https://github.com/apache/flink/pull/29367#issuecomment-5954415336
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "d037e77a3da37deb6fe723e45ea13f2e208de072",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "d037e77a3da37deb6fe723e45ea13f2e208de072",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* d037e77a3da37deb6fe723e45ea13f2e208de072 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-28737][table-planner] Check Calc filter on updating input in the NDU analyzer [flink]
Posted by "lincoln-lil (via GitHub)" <gi...@apache.org>.
lincoln-lil commented on code in PR #29367:
URL: https://github.com/apache/flink/pull/29367#discussion_r4227561588
##########
docs/content/docs/concepts/sql-table-concepts/determinism.md:
##########
@@ -191,6 +191,8 @@ On query pipeline with update messages and cannot derive the update key, the fol
2. LookupJoin on an evolving source
3. [CDC source]({{< ref "docs/connectors/table/kafka" >}}#cdc-changelog-source) carries metadata fields(system columns, not belongs to the entity row itself)
+Even when the update key can be derived, a non-deterministic function in a filter or in a regular join condition is an NDU problem as well: the condition decides whether a row and later its retraction are emitted, so `WHERE b > UNIX_TIMESTAMP() - 300` on a CDC table can drop the retraction of a row whose insert passed. `TRY_RESOLVE` rejects such conditions.
Review Comment:
nit: would it make sense to scope this statement to Calcs that evaluate the predicate independently on inserts and retractions? Filters inside ChangelogNormalize emit retractions from state without re-evaluating the predicate, so the distinction matters here (FLINK-40898). This could also be reflected in both translations and the class-level comment.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org