VasShabu commented on code in PR #29967:
URL: https://github.com/apache/flink/pull/29967#discussion_r4631798568
##########
docs/content.zh/docs/sql/reference/queries/deduplication.md:
##########
@@ -69,4 +69,114 @@ FROM (
WHERE row_num = 1
```
+## DEDUPLICATE
+
+{{< label Streaming >}}
+
+The `DEDUPLICATE` process table function (PTF) keeps the first or the last row
per key of an append-only table, as long as the state of the key is retained.
Unlike the `ROW_NUMBER()` pattern above, it needs no time attribute. Rows are
ordered by arrival or by `sequence_by` columns.
+
+### Syntax
+
+```sql
+SELECT * FROM DEDUPLICATE(
+ input => TABLE source_table PARTITION BY key_col[, ...],
+ [keep => 'first' | 'last',]
+ [sequence_by => DESCRIPTOR(col[, ...]),]
+ [state_ttl => INTERVAL '1' HOUR,]
+ [reset_ttl_on_duplicate => true | false,]
+ [uid => 'my-id']
+)
+```
+
+### Parameters
+
+| Parameter | Required | Description |
+|:----------|:---------|:------------|
+| `input` | Yes | The append-only input table. `PARTITION BY` is required and
its columns are the key of the output. `ORDER BY` is not supported, use
`sequence_by` instead. |
+| `keep` | No | `'first'` (default) keeps the earliest arrival or the smallest
`sequence_by` value, `'last'` keeps the latest arrival or the greatest. Must be
a literal. Arrival order is not deterministic across reruns, use `sequence_by`
for a repeatable result. |
+| `sequence_by` | No | One or more columns that order the records of a key
instead of their arrival. The first column decides, later columns break ties,
and `NULL` orders below every other value. On a tie, the later arrival wins for
`'last'` and the earlier one for `'first'`. Columns must be numeric, string,
binary, boolean or date-time, and not part of `PARTITION BY`. |
+| `state_ttl` | No | The minimum time the state of an idle key is retained, in
processing time, as a non-negative `INTERVAL` literal. If omitted,
`table.exec.state.ttl` applies, including later changes to it. `INTERVAL '0'`
retains state indefinitely; the TTL is then left out of the state, so one
cannot be added later without losing the state. When the state of a key
expires, its next record is treated as the first one and emits `+I` again, so a
sink without an upsert key can hold several rows for that key. |
+| `reset_ttl_on_duplicate` | No | Whether a record that is dropped refreshes
the TTL of its key. Defaults to `true`. Has no effect without a TTL. |
+| `uid` | No | A unique identifier for the PTF invocation. Defaults to
`DEDUPLICATE`. See [Multiple Invocations]({{< ref
"docs/sql/reference/queries/changelog" >}}#multiple-invocations). |
Review Comment:
removed that point, requested to be deleted in a prior comment
https://github.com/apache/flink/pull/29967#discussion_r4627297671
--
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]