Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How Retraction fallback updates in FlinkSQL are carried out

Shulou Source: shulou.com Published: 2022-06-01 10:31:53 09月19日 Update

How the Retraction fallback update in FlinkSQL is carried out, I believe many inexperienced people are at a loss about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Preface

If you get the following error when using FlinkSQL:

Table is not an append-only table. Use the toRetractStream () in order to handle add and retract messages. Then you need to know about fallback updates in Flink. Brief introduction

Generally speaking, "fallback update" is the update operation in traditional data, that is to say, Retract is the processing of data update in streaming computing scenarios.

Using flinkSQL to process real-time data when we convert a table into a stream, we need to use both toAppendStream and toRetractStream methods. If you don't pay attention, you may have chosen toAppendStream directly.

Difference

Append mode: this mode can only be used if dynamic Table is modified only through INSERT, that is, it is only attached, and previously issued results are never updated.

If the update or delete operation uses append mode, it will fail to report an error.

Indent mode: you can always use this mode. The return value is of type boolean. It marks the insertion and withdrawal of data with true or false, and returns true for data insertion and false for data withdrawal.

According to the understanding of the official website, if the data is constantly added, you can use the append mode, while the rest cannot use the append mode, while the indentation mode can be applied to update, delete and other scenarios. The differences are shown in the following figure:

From the figure above, you can clearly see the difference between the two ways. When the sql statement we use contains: count () group by, we must use indentation mode.

For instance

The output of the above example is as follows:

The previous numbers are the same as the same set of operations, true represents write, and false represents recall.

After reading the above, have you mastered how the Retraction fallback update in FlinkSQL works? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Updates patterns data representatives methods examples content scenarios ways more results problems processing same popular necessary helpless to this end pictured above constantly Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi Microsoft Redmi Shulou Technology