xy720 commented on a change in pull request #3335: [ISSUE #3190]Add documents for delete simplifly URL: https://github.com/apache/incubator-doris/pull/3335#discussion_r409789052
########## File path: docs/documentation/cn/administrator-guide/load-data/delete-manual.md ########## @@ -0,0 +1,178 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +#Delete + +Delete不同于其他导入方式,它是一个同步过程。和Insert into相似,所有的Delete操作在Doris中是一个独立的导入作业,一般Delete语句需要指定表和分区以及删除的条件来涮选要删除的数据,并将会同时删除base表和rollup表的数据。 + +##语法 + +主要的Delete语法如下: + +``` +DELETE FROM table_name [PARTITION partition_name] + WHERE + column_name1 op value[ AND column_name2 op value ...]; +``` + +示例1: + +``` +DELETE FROM my_table PARTITION p1 + WHERE k1 = 3; +``` + +示例2: + +``` +DELETE FROM my_table PARTITION p1 + WHERE k1 < 3 AND k2 = "abc"; +``` + +下面介绍删除语句中使用到的参数: + +* PARTITION + + Delete语句的目标分区,若未指定,则此表必须为单分区表,否则无法delete + +* WHERE + + Delete语句的条件语句,所有删除语句都必须指定WHERE语句 + +说明: + +1. `Where`语句中的op的类型可包括`=,>,<,>=,<=,!=` +2. `Where`语句中的列只能是`key`列 +3. 当选定的`key`列不存在某个rollup表内时,无法进行delete +4. 条件语句中各个条件只能是`and`关系,如希望达成`or`可将条件分别写入两个delete语句中 +5. 如果指定表为RANGE分区表,则必须指定 `PARTITION`。如果是单分区表,可以不指定。 +6. 不同于Insert into命令,delete不能手动指定`label`,有关label的概念可以查看[Insert Into文档] (./insert-into-manual.md) + +##返回结果 + +Delete命令是一个SQL命令,返回结果是同步的,分为以下几种: Review comment: Doris的事务提交分为两步:提交和发布版本,具体方法可以看GlobalTransaction里的commitTransactionAndPublish。 只有完成了第二步,结果才对用户是可见的。但如果第一步提交成功了,那么其实就可以认为最终一定会发布成功,而Doris会尝试在提交完后等待发布版本一段时间,如果超时后即使发布版本仍未完成,也会优先返回给用户结果,提示用户提交已经完成但未可见。 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org