zhannngchen commented on code in PR #21623:
URL: https://github.com/apache/doris/pull/21623#discussion_r1257743582


##########
docs/zh-CN/docs/data-operate/import/import-scenes/load-strict-mode.md:
##########
@@ -131,3 +131,50 @@ under the License.
    > 1. 表中的列允许导入空值
    > 2. `abc` 在转换为 Decimal 后,会因类型问题变为 NULL。在严格模式开启的情况下,这类数据将会被过滤。而如果是关闭状态,则会导入 
`null`。
    > 3. `10` 虽然是一个超过范围的值,但是因为其类型符合 decimal 的要求,所以严格模式对其不产生影响。`10` 
最后会在其他导入处理流程中被过滤。但不会被严格模式过滤。
+
+- 限定部分列更新只能更新已有的列
+
+在严格模式下,部分列更新插入的每一行数据必须满足该行数据的key在表中已经存在。而在而非严格模式下,进行部分列更新时可以更新key已经存在的行,也可以插入key不存在的新行。
+
+例如有表结构如下:
+```
+mysql> desc user_profile;
++------------------+-----------------+------+-------+---------+-------+
+| Field            | Type            | Null | Key   | Default | Extra |
++------------------+-----------------+------+-------+---------+-------+
+| id               | INT             | Yes  | true  | NULL    |       |
+| name             | VARCHAR(10)     | Yes  | false | NULL    | NONE  |
+| age              | INT             | Yes  | false | NULL    | NONE  |
+| city             | VARCHAR(10)     | Yes  | false | NULL    | NONE  |
+| balance          | DECIMALV3(9, 0) | Yes  | false | NULL    | NONE  |
+| last_access_time | DATETIME        | Yes  | false | NULL    | NONE  |
++------------------+-----------------+------+-------+---------+-------+
+```
+
+表中有一条数据如下:
+
+```
+1,"kevin",18,"shenzhen",400,"2023-07-01 12:00:00"
+```
+
+当用户使用非严格模式的stram load部分列更新向表中插入如下数据时
+
+```
+1,500,2023-07-03 12:00:01
+3,23,2023-07-03 12:00:02
+18,9999999,2023-07-03 12:00:03
+```
+
+```
+curl  --location-trusted -u root -H "partial_columns:true" -H 
"strict_mode:false" -H "column_separator:," -H 
"columns:id,balance,last_access_time" -T /tmp/test.csv 
http://host:port/api/db1/user_profile/_stream_load
+```
+
+表中原有的一条数据将会被更新,此外还向表中插入了两条新数据。对于插入的数据中用户没有指定的列,如果该列有默认值,则会议默认值填充;否则,如果该列可以为NULL,则将以NULL值填充;否则本次插入不成功。

Review Comment:
   会议->会以



##########
regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_upsert.groovy:
##########
@@ -0,0 +1,68 @@
+
+// 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.
+
+suite("test_partial_update_upsert", "p0") {
+    def tableName = "test_partial_update_upsert"
+
+    sql """ DROP TABLE IF EXISTS ${tableName} """
+    sql """
+            CREATE TABLE ${tableName} ( 
+                `id` int(11) NULL, 
+                `name` varchar(10) NULL,
+                `age` int(11) NULL DEFAULT "20", 
+                `city` varchar(10) NOT NULL DEFAULT "beijing", 
+                `balance` decimalv3(9, 0) NULL, 
+                `last_access_time` datetime NULL 
+            ) ENGINE = OLAP UNIQUE KEY(`id`) 
+            COMMENT 'OLAP' DISTRIBUTED BY HASH(`id`) 
+            BUCKETS AUTO PROPERTIES ( 
+                "replication_allocation" = "tag.location.default: 1", 
+                "storage_format" = "V2", 
+                "enable_unique_key_merge_on_write" = "true", 
+                "light_schema_change" = "true", 
+                "disable_auto_compaction" = "false", 
+                "enable_single_replica_compaction" = "false" 
+            );
+    """
+
+    sql """
+        insert into ${tableName} 
values(1,"kevin",18,"shenzhen",400,"2023-07-01 12:00:00");
+    """
+
+    qt_sql """select * from ${tableName} order by id;"""
+
+    streamLoad {

Review Comment:
   check the streamload with strict_mode=ture will fail, then strict_mode=false 
will success



##########
docs/zh-CN/docs/data-operate/import/import-scenes/load-strict-mode.md:
##########
@@ -131,3 +131,50 @@ under the License.
    > 1. 表中的列允许导入空值
    > 2. `abc` 在转换为 Decimal 后,会因类型问题变为 NULL。在严格模式开启的情况下,这类数据将会被过滤。而如果是关闭状态,则会导入 
`null`。
    > 3. `10` 虽然是一个超过范围的值,但是因为其类型符合 decimal 的要求,所以严格模式对其不产生影响。`10` 
最后会在其他导入处理流程中被过滤。但不会被严格模式过滤。
+
+- 限定部分列更新只能更新已有的列
+
+在严格模式下,部分列更新插入的每一行数据必须满足该行数据的key在表中已经存在。而在而非严格模式下,进行部分列更新时可以更新key已经存在的行,也可以插入key不存在的新行。
+
+例如有表结构如下:
+```
+mysql> desc user_profile;
++------------------+-----------------+------+-------+---------+-------+
+| Field            | Type            | Null | Key   | Default | Extra |
++------------------+-----------------+------+-------+---------+-------+
+| id               | INT             | Yes  | true  | NULL    |       |
+| name             | VARCHAR(10)     | Yes  | false | NULL    | NONE  |
+| age              | INT             | Yes  | false | NULL    | NONE  |
+| city             | VARCHAR(10)     | Yes  | false | NULL    | NONE  |
+| balance          | DECIMALV3(9, 0) | Yes  | false | NULL    | NONE  |
+| last_access_time | DATETIME        | Yes  | false | NULL    | NONE  |
++------------------+-----------------+------+-------+---------+-------+
+```
+
+表中有一条数据如下:
+
+```
+1,"kevin",18,"shenzhen",400,"2023-07-01 12:00:00"
+```
+
+当用户使用非严格模式的stram load部分列更新向表中插入如下数据时
+
+```
+1,500,2023-07-03 12:00:01
+3,23,2023-07-03 12:00:02
+18,9999999,2023-07-03 12:00:03
+```
+
+```
+curl  --location-trusted -u root -H "partial_columns:true" -H 
"strict_mode:false" -H "column_separator:," -H 
"columns:id,balance,last_access_time" -T /tmp/test.csv 
http://host:port/api/db1/user_profile/_stream_load
+```
+
+表中原有的一条数据将会被更新,此外还向表中插入了两条新数据。对于插入的数据中用户没有指定的列,如果该列有默认值,则会议默认值填充;否则,如果该列可以为NULL,则将以NULL值填充;否则本次插入不成功。

Review Comment:
   会议->会以



-- 
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]

Reply via email to