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 ea26169b2a7 [test](regression) add cases for data quality error url
(#34987)
ea26169b2a7 is described below
commit ea26169b2a707570e2020b7233265fda78bb92a1
Author: Kaijie Chen <[email protected]>
AuthorDate: Fri May 17 22:33:40 2024 +0800
[test](regression) add cases for data quality error url (#34987)
---
be/src/common/status.h | 2 +-
be/src/vec/sink/vtablet_finder.cpp | 4 +-
.../test_insert_partition_fail_url.groovy | 91 ++++++++++++++++++++++
.../insert_p0/test_insert_strict_fail_url.groovy | 87 +++++++++++++++++++++
4 files changed, 181 insertions(+), 3 deletions(-)
diff --git a/be/src/common/status.h b/be/src/common/status.h
index 0fa6257bd00..09a22311af9 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -563,7 +563,7 @@ inline std::string Status::to_string() const {
}
inline std::string Status::to_string_no_stack() const {
- return fmt::format("[{}] {}", code_as_string(), msg());
+ return fmt::format("[{}]{}", code_as_string(), msg());
}
// some generally useful macros
diff --git a/be/src/vec/sink/vtablet_finder.cpp
b/be/src/vec/sink/vtablet_finder.cpp
index 2e0d278fa4f..3bfd5bb4d22 100644
--- a/be/src/vec/sink/vtablet_finder.cpp
+++ b/be/src/vec/sink/vtablet_finder.cpp
@@ -62,7 +62,7 @@ Status OlapTabletFinder::find_tablets(RuntimeState* state,
Block* block, int row
_num_filtered_rows++;
_filter_bitmap.Set(row_index, true);
if (stop_processing) {
- return Status::EndOfFile("Encountered unqualified data, stop
processing");
+ return Status::DataQualityError("Encountered unqualified data,
stop processing");
}
skip[row_index] = true;
continue;
@@ -104,4 +104,4 @@ Status OlapTabletFinder::find_tablets(RuntimeState* state,
Block* block, int row
return Status::OK();
}
-} // namespace doris::vectorized
\ No newline at end of file
+} // namespace doris::vectorized
diff --git
a/regression-test/suites/insert_p0/test_insert_partition_fail_url.groovy
b/regression-test/suites/insert_p0/test_insert_partition_fail_url.groovy
new file mode 100644
index 00000000000..9b0a7f3a1a7
--- /dev/null
+++ b/regression-test/suites/insert_p0/test_insert_partition_fail_url.groovy
@@ -0,0 +1,91 @@
+// 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_partition_fail_url") {
+ def dbName = "regression_test_insert_p0"
+ def srcTableName = "test_insert_partition_fail_url_src"
+ def dstTableName = "test_insert_partition_fail_url_dst"
+ def srcName = dbName + "." + srcTableName
+ def dstName = dbName + "." + dstTableName
+
+ // create table
+ sql """ drop table if exists ${srcName}; """
+ sql """
+ CREATE TABLE ${srcName} (
+ `id` int NOT NULL,
+ `score` int NULL default "-1"
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ drop table if exists ${dstName}; """
+ sql """
+ CREATE TABLE ${dstName} (
+ `id` int NOT NULL,
+ `score` int NULL default "-1"
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ PARTITION BY RANGE(`id`)
+ (
+ PARTITION `p0` VALUES LESS THAN ("0"),
+ PARTITION `p1` VALUES LESS THAN ("2")
+ )
+ DISTRIBUTED BY HASH(`id`) BUCKETS 2
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ SET enable_insert_strict = true; """
+
+ // prepare data
+ sql """
+ INSERT INTO ${srcName} (`id`, `score`)
+ VALUES (0, 9), (1, 7), (2, 10), (3, 6), (4, 5), (5, 8);
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+
+ expectExceptionLike({
+ sql """
+ INSERT INTO ${dstName} SELECT `id`, `score` FROM ${srcName};
+ """
+ }, "Insert has filtered data in strict mode. url: ")
+
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+
+ expectExceptionLike({
+ sql """
+ INSERT INTO ${dstName} SELECT `id`, `score` FROM ${srcName};
+ """
+ }, "[DATA_QUALITY_ERROR]Encountered unqualified data, stop processing.
url: ")
+}
diff --git
a/regression-test/suites/insert_p0/test_insert_strict_fail_url.groovy
b/regression-test/suites/insert_p0/test_insert_strict_fail_url.groovy
new file mode 100644
index 00000000000..8d95a423cdd
--- /dev/null
+++ b/regression-test/suites/insert_p0/test_insert_strict_fail_url.groovy
@@ -0,0 +1,87 @@
+// 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_strict_fail_url") {
+ def dbName = "regression_test_insert_p0"
+ def srcTableName = "test_insert_strict_fail_url_src"
+ def dstTableName = "test_insert_strict_fail_url_dst"
+ def srcName = dbName + "." + srcTableName
+ def dstName = dbName + "." + dstTableName
+
+ // create table
+ sql """ drop table if exists ${srcName}; """
+ sql """
+ CREATE TABLE ${srcName} (
+ `key` int NOT NULL,
+ `id` int NULL,
+ `score` int NULL default "-1"
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`key`)
+ DISTRIBUTED BY HASH(`key`) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ drop table if exists ${dstName}; """
+ sql """
+ CREATE TABLE ${dstName} (
+ `id` int NOT NULL,
+ `score` int NULL default "-1"
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 2
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ SET enable_insert_strict = true; """
+
+ // prepare data
+ sql """
+ INSERT INTO ${srcName} (`key`, `id`, `score`)
+ VALUES (0, 1, 9), (1, 2, 7), (2, NULL, 10), (3, NULL, 6), (4, NULL,
5), (5, NULL, 8);
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+
+ expectExceptionLike({
+ sql """
+ INSERT INTO ${dstName} SELECT `id`, `score` FROM ${srcName};
+ """
+ }, "Insert has filtered data in strict mode. url: ")
+
+ sql """
+ INSERT INTO ${srcName} SELECT * FROM ${srcName};
+ """
+
+ expectExceptionLike({
+ sql """
+ INSERT INTO ${dstName} SELECT `id`, `score` FROM ${srcName};
+ """
+ }, "[DATA_QUALITY_ERROR]Encountered unqualified data, stop processing.
url: ")
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]