This is an automated email from the ASF dual-hosted git repository.

liaoxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c55b53be45 [test](load) add p0 cases for insert docs (#44364)
4c55b53be45 is described below

commit 4c55b53be45940d3392d633c76d2b151e32fe8c7
Author: Kaijie Chen <chenkai...@selectdb.com>
AuthorDate: Wed Dec 4 15:36:06 2024 +0800

    [test](load) add p0 cases for insert docs (#44364)
    
    Add cases in INSERT INTO VALUES and INSERT INTO docs demos.
---
 .../data/insert_p0/test_insert_docs_demo.out       |   6 ++
 .../suites/insert_p0/test_insert_docs_demo.groovy  | 111 +++++++++++++++++++++
 2 files changed, 117 insertions(+)

diff --git a/regression-test/data/insert_p0/test_insert_docs_demo.out 
b/regression-test/data/insert_p0/test_insert_docs_demo.out
new file mode 100644
index 00000000000..f984fb09c6d
--- /dev/null
+++ b/regression-test/data/insert_p0/test_insert_docs_demo.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !insert --
+5      Ava     17
+1      Emily   25
+3      Olivia  28
+
diff --git a/regression-test/suites/insert_p0/test_insert_docs_demo.groovy 
b/regression-test/suites/insert_p0/test_insert_docs_demo.groovy
new file mode 100644
index 00000000000..b56df70e344
--- /dev/null
+++ b/regression-test/suites/insert_p0/test_insert_docs_demo.groovy
@@ -0,0 +1,111 @@
+// 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.
+
+import com.mysql.cj.jdbc.StatementImpl
+
+suite("test_insert_docs_demo") {
+    def dbName = "regression_test_insert_p0"
+    def srcTableName = "test_insert_docs_demo_src"
+    def dstTableName = "test_insert_docs_demo_dst"
+    def srcName = dbName + "." + srcTableName
+    def dstName = dbName + "." + dstTableName
+
+    // create table
+    sql """ drop table if exists ${srcName}; """
+    sql """
+        CREATE TABLE ${srcName}(
+            user_id            BIGINT       NOT NULL COMMENT "user id",
+            name               VARCHAR(20)           COMMENT "name",
+            age                INT                   COMMENT "age"
+        ) DUPLICATE KEY(user_id)
+        DISTRIBUTED BY HASH(user_id) BUCKETS 10;
+    """
+
+    sql """ drop table if exists ${dstName}; """
+    sql """
+        CREATE TABLE ${dstName}(
+            user_id            BIGINT       NOT NULL COMMENT "user id",
+            name               VARCHAR(20)           COMMENT "name",
+            age                INT                   COMMENT "age"
+        ) DUPLICATE KEY(user_id)
+        DISTRIBUTED BY HASH(user_id) BUCKETS 10;
+    """
+
+    sql """ SET enable_insert_strict = true; """
+
+    // insert into values
+    sql """
+        INSERT INTO ${srcName} (user_id, name, age)
+        VALUES (1, "Emily", 25),
+            (2, "Benjamin", 35),
+            (3, "Olivia", 28),
+            (4, "Alexander", 60),
+            (5, "Ava", 17);
+    """
+
+    // insert into
+    sql """
+        INSERT INTO ${dstName}
+        SELECT * FROM ${srcName} WHERE age < 30;
+    """
+
+    qt_insert """
+        SELECT * FROM ${dstName} ORDER BY age;
+    """
+
+    // The error message may vary due to variations in fuzzy execution 
instance number or batch size.
+    // like this:
+    // Insert has filtered data in strict mode. url: 
http://172.16.0.10:8041/api/_load_error_log?
+    // 
file=__shard_303/error_log_insert_stmt_a1ccfb9c67ba40f5-900d0db1d06a19dd_a1ccfb9c67ba40f5_900d0db1d06a19dd
+    // or like this:
+    // [DATA_QUALITY_ERROR]Encountered unqualified data, stop processing. url: 
http://172.16.0.10:8041/api/_load_error_log?
+    // 
file=__shard_303/error_log_insert_stmt_a1ccfb9c67ba40f5-900d0db1d06a19dd_a1ccfb9c67ba40f5_900d0db1d06a19dd
+    expectExceptionLike({
+        sql """
+            INSERT INTO ${srcName} (user_id, name, age)
+            VALUES (1, "Emily", 25),
+                (2, "Benjamin", 35),
+                (3, "Olivia", 28),
+                (NULL, "Alexander", 60),
+                (5, "Ava", 17);
+        """
+    }, "error_log")
+
+    sql """ SET enable_insert_strict = false; """
+
+    sql """
+        INSERT INTO ${srcName} (user_id, name, age)
+        VALUES (1, "Emily", 25),
+            (2, "Benjamin", 35),
+            (3, "Olivia", 28),
+            (NULL, "Alexander", 60),
+            (5, "Ava", 17);
+    """
+
+    sql """ SET insert_max_filter_ratio = 0.1 """
+
+    expectExceptionLike({
+        sql """
+            INSERT INTO ${srcName} (user_id, name, age)
+            VALUES (1, "Emily", 25),
+                (2, "Benjamin", 35),
+                (3, "Olivia", 28),
+                (NULL, "Alexander", 60),
+                (5, "Ava", 17);
+        """
+    }, "Insert has too many filtered data 1/5 insert_max_filter_ratio is 0.1")
+}


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

Reply via email to