## Background

The current Doris table does not support the update operation, but there
are many scenarios where the data needs to be updated. Due to the batch
delete function we implemented before, it paved the way for the update.

## Syntax

We only support single table update

```
UPDATE table_name
    SET assignment_list
    [WHERE where_condition]
    [ORDER BY...]
    [LIMIT row_count]

value:
    {expr | DEFAULT}

assignment:
    col_name = value

assignment_list:
    assignment [, assignment].
```

## Design

There are two kinds of updates involved here, one that only contains the
value column, and the other that contains the key column.

* Include and update of value column

  This method is relatively simple. You only need to plan the update
statement into a query plan like `select * from table insert into table`
during query planning, and you need to add an update node to modify the
data to the updated value, or plan Into a statement similar to `select a,
b,'xx','xx1' from table insert into table` and hand it directly to the
tableSink node

* Contains the update of the key column

  This kind of relatively complicated, we need to divide the query into two
parts, and need to use the MERGE semantics in the batch delete, first plan
it into a query plan similar to `select * from table insert into table`,
and then generate it first for the modification of the key column One piece
of data that needs to be deleted, and then replace the value of the key
column to generate new data that needs to be added, mainly generating two
pieces of imported data from one piece of original data. Need update node
to have the ability to repeat data

## Subtasks

1. Add index to unique table value column to speed up data scanning
2. FE supports update statements and generates corresponding query plans.
Be implements update node, which can be divided into two parts here
   1. Support updates that only contain the value column
   2. Support the update of the key column

Reply via email to