Flink 理解RowKind的UPDATE_BEFORE的含义

ax6ht2ek  于 11个月前  发布在  Apache
关注(0)|答案(1)|浏览(165)

我正在阅读RowKind#UPDATE_BEFORE的javadoc,它说:

/**
     * Update operation with the previous content of the updated row.
     *
     * <p>This kind SHOULD occur together with {@link #UPDATE_AFTER} for modelling an update that
     * needs to retract the previous row first. It is useful in cases of a non-idempotent update,
     * i.e., an update of a row that is not uniquely identifiable by a key.
     */
    UPDATE_BEFORE("-U", (byte) 1),

字符串
我会问:
1.如果行is not uniquely identifiable by a key,flink怎么知道要收回哪一行,我想肯定有唯一的键来识别这一行?
1.它说它对non-idempotent update有用,non-idempotent update在这里是什么意思?

pkwftd7m

pkwftd7m1#

1.在表API中,行可以具有主键。
1.考虑到这种情况
id|数据,数据
1|数据_1
二个|数据_1
如果我们有一个像上面这样的表。我们可以像“update data set data='data_x' where id = 1”这样更新一行,在这种情况下,id不是update,这是“幂等更新”
但如果我们有这样的表(缺少id字段)
data data_1 data_1
那么对第二行的更新是“非幂等更新”,因为我们没有标识该行对象的ID或唯一的东西。

相关问题