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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 55d5ed9ab6157c2813b021c6f23bfaf6402808e9
Author: HHoflittlefish777 <77738092+hhoflittlefish...@users.noreply.github.com>
AuthorDate: Thu Apr 25 19:45:09 2024 +0800

    [test](streamload) add load empty file regression test (#34110)
---
 .../data/load_p0/stream_load/test_empty_file.csv   |  0
 .../stream_load/test_stream_load_empty_file.out    |  3 +
 .../stream_load/test_stream_load_empty_file.groovy | 73 ++++++++++++++++++++++
 3 files changed, 76 insertions(+)

diff --git a/regression-test/data/load_p0/stream_load/test_empty_file.csv 
b/regression-test/data/load_p0/stream_load/test_empty_file.csv
new file mode 100644
index 00000000000..e69de29bb2d
diff --git 
a/regression-test/data/load_p0/stream_load/test_stream_load_empty_file.out 
b/regression-test/data/load_p0/stream_load/test_stream_load_empty_file.out
new file mode 100644
index 00000000000..9c9c4c6c8a2
--- /dev/null
+++ b/regression-test/data/load_p0/stream_load/test_stream_load_empty_file.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+
diff --git 
a/regression-test/suites/load_p0/stream_load/test_stream_load_empty_file.groovy 
b/regression-test/suites/load_p0/stream_load/test_stream_load_empty_file.groovy
new file mode 100644
index 00000000000..9265280ecae
--- /dev/null
+++ 
b/regression-test/suites/load_p0/stream_load/test_stream_load_empty_file.groovy
@@ -0,0 +1,73 @@
+// 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_stream_load_empty_file", "p0") {
+    def tableName = "test_stream_load_empty_file"
+    try {
+        sql """ DROP TABLE IF EXISTS ${tableName} """
+        sql """
+            CREATE TABLE IF NOT EXISTS ${tableName} (
+                `k1` bigint(20) NULL,
+                `k2` bigint(20) NULL,
+                `v1` tinyint(4) SUM NULL,
+                `v2` tinyint(4) REPLACE NULL,
+                `v3` tinyint(4) REPLACE_IF_NOT_NULL NULL,
+                `v4` smallint(6) REPLACE_IF_NOT_NULL NULL,
+                `v5` int(11) REPLACE_IF_NOT_NULL NULL,
+                `v6` bigint(20) REPLACE_IF_NOT_NULL NULL,
+                `v7` largeint(40) REPLACE_IF_NOT_NULL NULL,
+                `v8` datetime REPLACE_IF_NOT_NULL NULL,
+                `v9` date REPLACE_IF_NOT_NULL NULL,
+                `v10` char(10) REPLACE_IF_NOT_NULL NULL,
+                `v11` varchar(6) REPLACE_IF_NOT_NULL NULL,
+                `v12` decimal(27, 9) REPLACE_IF_NOT_NULL NULL
+            ) ENGINE=OLAP
+            AGGREGATE KEY(`k1`, `k2`)
+            COMMENT 'OLAP'
+            PARTITION BY RANGE(`k1`)
+            (PARTITION partition_a VALUES [("-9223372036854775808"), 
("100000")),
+            PARTITION partition_b VALUES [("100000"), ("1000000000")),
+            PARTITION partition_c VALUES [("1000000000"), ("10000000000")),
+            PARTITION partition_d VALUES [("10000000000"), (MAXVALUE)))
+            DISTRIBUTED BY HASH(`k1`, `k2`) BUCKETS 3
+            PROPERTIES ("replication_allocation" = "tag.location.default: 1");
+        """
+
+        // test strict_mode success
+        streamLoad {
+            table "${tableName}"
+
+            file 'test_empty_file.csv'
+
+            check { result, exception, startTime, endTime ->
+                if (exception != null) {
+                    throw exception
+                }
+                log.info("Stream load result: ${result}".toString())
+                def json = parseJson(result)
+                assertEquals("success", json.Status.toLowerCase())
+                assertEquals(0, json.NumberTotalRows)
+            }
+            time 10000 // limit inflight 10s
+        }
+
+        sql "sync"
+        qt_sql "select * from ${tableName}"
+    } finally {
+        sql """ DROP TABLE IF EXISTS ${tableName} """
+    }
+}
\ No newline at end of file


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

Reply via email to