You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "nanfeng1999 (via GitHub)" <gi...@apache.org> on 2023/06/10 02:58:20 UTC

[GitHub] [doris] nanfeng1999 opened a new pull request, #20657: [doc](insert-overwrite) add related doc

nanfeng1999 opened a new pull request, #20657:
URL: https://github.com/apache/doris/pull/20657

   add insert overwrite doc
   
   ## Proposed changes
   
   Issue Number: close #xxx
   
   <!--Describe your changes.-->
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] nanfeng1999 commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "nanfeng1999 (via GitHub)" <gi...@apache.org>.
nanfeng1999 commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1585618000

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zy-kkk merged pull request #20657: [doc](insert-overwrite) add related doc

Posted by "zy-kkk (via GitHub)" <gi...@apache.org>.
zy-kkk merged PR #20657:
URL: https://github.com/apache/doris/pull/20657


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1592249363

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1587509810

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1588345531

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] nanfeng1999 commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "nanfeng1999 (via GitHub)" <gi...@apache.org>.
nanfeng1999 commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1589205943

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #20657: [doc](insert-overwrite) add related doc

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #20657:
URL: https://github.com/apache/doris/pull/20657#discussion_r1225421464


##########
docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/INSERT OVERWRITE.md:
##########
@@ -0,0 +1,182 @@
+---
+{
+    "title": "INSERT",
+    "language": "zh-CN"
+}
+---
+
+<!--
+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.
+-->
+
+## INSERT OVERWRITE
+
+### Name
+
+INSERT OVERWRITE
+
+### Description
+
+该语句的功能是重写表或表的某个分区
+
+```sql
+INSERT OVERWRITE table table_name
+    [ PARTITION (p1, ...) ]
+    [ WITH LABEL label]
+    [ (column [, ...]) ]
+    [ [ hint [, ...] ] ]
+    { VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
+```
+
+ Parameters
+
+> table_name: 需要重写的目的表。这个表必须存在。可以是 `db_name.table_name` 形式
+>
+> partitions: 需要重写的表分区,必须是 `table_name` 中存在的分区,多个分区名称用逗号分隔
+>
+> label: 为 Insert 任务指定一个 label
+>
+> column_name: 指定的目的列,必须是 `table_name` 中存在的列
+>
+> expression: 需要赋值给某个列的对应表达式
+>
+> DEFAULT: 让对应列使用默认值
+>
+> query: 一个普通查询,查询的结果会重写到目标中
+>
+> hint: 用于指示 `INSERT` 执行行为的一些指示符。目前 hint 有三个可选值`/*+ STREAMING */`、`/*+ SHUFFLE */`或`/*+ NOSHUFFLE */`
+> 1. STREAMING:目前无实际作用,只是为了兼容之前的版本,因此保留。(之前的版本加上这个 hint 会返回 label,现在默认都会返回 label)
+> 2. SHUFFLE:当目标表是分区表,开启这个 hint 会进行 repartiiton。
+> 3. NOSHUFFLE:即使目标表是分区表,也不会进行 repartiiton,但会做一些其他操作以保证数据正确落到各个分区中。
+
+注意:
+
+在当前版本中,会话变量 `enable_insert_strict` 默认为 `true`,如果执行 `INSERT OVERWRITE` 语句时,对于有不符合目标表格式的数据被过滤掉的话会重写目标表失败(比如重写分区时,不满足所有分区条件的数据会被过滤)。
+
+INSERT OVERWRITE语句会首先创建一个新表,将需要重写的数据插入到新表中,最后原子性的用新表替换旧表并修改名称。因此,在重写表的过程中,旧表中的数据在重写完毕之前仍然可以正常访问。
+
+### Example
+
+假设有`test` 表。该表包含两个列`c1`, `c2`,两个分区`p1`,`p2`。建表语句如下所示
+
+```sql
+CREATE TABLE IF NOT EXISTS test (
+  `c1` int NOT NULL DEFAULT "1",
+  `c2` int NOT NULL DEFAULT "4"
+) ENGINE=OLAP
+UNIQUE KEY(`c1`)
+PARTITION BY LIST (`c1`)
+(
+PARTITION p1 VALUES IN ("1","2","3"),# 分区p1只允许1 2 3存在
+PARTITION p2 VALUES IN ("4","5","6") # 分区p2只允许1 5 6存在
+)
+DISTRIBUTED BY HASH(`c1`) BUCKETS 3
+PROPERTIES (
+  "replication_allocation" = "tag.location.default: 1",
+  "in_memory" = "false",
+  "storage_format" = "V2"
+);
+```
+
+#### Overwrite Table
+
+1. VALUES的形式重写`test`表
+
+```sql

Review Comment:
   4 spaces as indent



##########
docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/INSERT OVERWRITE.md:
##########
@@ -0,0 +1,182 @@
+---
+{
+    "title": "INSERT",

Review Comment:
   ```suggestion
       "title": "INSERT-OVERWRITE",
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20657: [doc](insert-overwrite) add related doc

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20657:
URL: https://github.com/apache/doris/pull/20657#issuecomment-1587509877

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org