Sequence and Rowkind

When creating a table, you can specify the 'sequence.field' by specifying fields to determine the order of updates, or you can specify the 'rowkind.field' to determine the changelog kind of record.

Sequence Field

By default, the primary key table determines the merge order according to the input order (the last input record will be the last to merge). However, in distributed computing, there will be some cases that lead to data disorder. At this time, you can use a time field as sequence.field, for example:

Flink

  1. CREATE TABLE my_table (
  2. pk BIGINT PRIMARY KEY NOT ENFORCED,
  3. v1 DOUBLE,
  4. v2 BIGINT,
  5. update_time TIMESTAMP
  6. ) WITH (
  7. 'sequence.field' = 'update_time'
  8. );

The record with the largest sequence.field value will be the last to merge, if the values are the same, the input order will be used to determine which one is the last one. sequence.field supports fields of all data types.

You can define multiple fields for sequence.field, for example 'update_time,flag', multiple fields will be compared in order.

User defined sequence fields conflict with features such as first_row and first_value, which may result in unexpected results.

Row Kind Field

By default, the primary key table determines the row kind according to the input row. You can also define the 'rowkind.field' to use a field to extract row kind.

The valid row kind string should be '+I', '-U', '+U' or '-D'.