EmmyMiao87 opened a new pull request #6230:
URL: https://github.com/apache/incubator-doris/pull/6230
## Proposed changes
[Update] Support update syntax
The current update syntax only supports updating the filtered data of a
single table.
Syntax:
* UPDATE table_reference
* SET assignment_list
* [WHERE where_condition]
*
* value:
* {expr}
*
* assignment:
* col_name = value
*
* assignment_list:
* assignment [, assignment] ...
Example
Update unique_table
set v1=1
where k1=1
New Frontend Config: enable_concurrent_update
This configuration is used to control whether multi update stmt can be
executed concurrently in one table.
Default value is false which means A table can only have one update task
being executed at the same time.
If users want to update the same table concurrently,
they need to modify the configuration value to true and restart the
master frontend.
Concurrent updates may cause write conflicts, the result is uncertain,
please be careful.
The main realization principle:
1. Read the rows that meet the conditions according to the conditions
set by where clause.
2. Modify the result of the row according to the set clause.
3. Write the modified row back to the table.
Some restrictions on the use of update syntax.
1. Only the unique table can be updated
2. Only the value column of the unique table can be updated
3. The where clause currently only supports single tables
Possible risks:
1. Since the current implementation method is a row update,
when the same table is updated concurrently, there may be
concurrency conflicts which may cause the incorrect result.
2. Once the conditions of the where clause are unsatisfactory, it is
likely to cause a full table scan and affect query performance.
Please pay attention to whether the column in the where clause can
match the index when using it.
[Docs][Update] Add update document and sql-reference
Fixed #6229
## Types of changes
What types of changes does your code introduce to Doris?
_Put an `x` in the boxes that apply_
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] Documentation Update (if none of the other choices apply)
- [x] Code refactor (Modify the code structure, format the code, etc...)
- [ ] Optimization. Including functional usability improvements and
performance improvements.
- [ ] Dependency. Such as changes related to third-party components.
- [ ] Other.
## Checklist
_Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look for
before merging your code._
- [x] I have created an issue on (Fix #6229) and described the bug/feature
there in detail
- [x] Compiling and unit tests pass locally with my changes
- [x] I have added tests that prove my fix is effective or that my feature
works
- [x] If these changes need document changes, I have updated the document
- [x] Any dependent changes have been merged
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]