VasShabu opened a new pull request, #29967: URL: https://github.com/apache/flink/pull/29967
## What is the purpose of the change Adds the built-in `DEDUPLICATE` process table function from [FLIP-622](https://cwiki.apache.org/confluence/spaces/FLINK/pages/462816464/FLIP-622+Add+built-in+DEDUPLICATE+and+DEDUPLICATE_WINDOW+PTFs) ยง4.1 for insert-only input. It keeps one row per `PARTITION BY` key, chosen by arrival order or by `sequence_by`, and emits an updating changelog whose upsert key is the partition key. Updating input and the docs page follow in separate PRs. ## Brief change log - `DEDUPLICATE` in `BuiltInFunctionDefinitions` with `DeduplicateTypeStrategy`: validates `PARTITION BY`, `keep`, `sequence_by`, `state_ttl` and `reset_ttl_on_duplicate` at planning time, and infers the output type and changelog mode (`+I`, `+U`, and `-U` only when a consumer requires it). - `Deduplicate` is specialized per call, and each specialization declares only the state it needs: - `keep => 'first'` without `sequence_by`: a BOOLEAN per key. - Otherwise: the kept row, without the key columns. - Table API `PartitionedTable#deduplicate(...)`; PyFlink `Table.partition_by(...)` and `PartitionedTable.deduplicate(...)`. ## Verifying this change This change added tests and can be verified as follows: - `DeduplicateTypeStrategyTest`: every validation error, the output type and the changelog mode. - `DeduplicateTest`: the state each specialization declares. - `DeduplicateTableFunctionTest`: plans for the upsert key, a retracting consumer, dropped time attributes and the Table API. - `DeduplicateSemanticTests`: arrival order, a composite non-adjacent and NULL key, `sequence_by` ordering (ties, NULL, NaN, multiple columns), and the missing `PARTITION BY` error. - `DeduplicateRestoreTest`: kept state for `'last'`, `'first'` and `sequence_by` survives a restore. - `DeduplicateHarnessTest`: `state_ttl` expiry and `reset_ttl_on_duplicate`. - PyFlink: `test_explain_deduplicate` and `PartitionedTable` API completeness. ## 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)`: yes (`PartitionedTable#deduplicate`, PyFlink `PartitionedTable`) - The serializers: no - The runtime per-record code paths (performance sensitive): yes, only for queries that call `DEDUPLICATE` - 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? yes - If yes, how is the feature documented? JavaDocs; the SQL docs page follows in a separate PR --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Code (Claude Opus 5.5) -- 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]
