Skip to content

Commit 2b233a4

Browse files
branch-4.1: [fix](errmsg) Fix wrong error message of insert overwrite #62555 (#62564)
Cherry-picked from #62555 Co-authored-by: zclllyybb <zhaochangle@selectdb.com>
1 parent e77064f commit 2b233a4

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ protected final void execImpl(StmtExecutor executor) throws Exception {
203203
if (!coordinator.getExecStatus().ok()) {
204204
errMsg = coordinator.getExecStatus().getErrorMsg();
205205
LOG.warn("insert [{}] with query id {} failed, {}", labelName, queryId, errMsg);
206-
ErrorReport.reportDdlException(errMsg, ErrorCode.ERR_FAILED_WHEN_INSERT);
206+
ErrorReport.reportDdlException("%s", ErrorCode.ERR_FAILED_WHEN_INSERT, errMsg);
207207
}
208208
if (LOG.isDebugEnabled()) {
209209
LOG.debug("insert [{}] with query id {} delta files is {}",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
suite("insert_overwrite_error_message_percent") {
19+
sql "drop table if exists insert_overwrite_error_message_percent_src"
20+
sql "drop table if exists insert_overwrite_error_message_percent_dst"
21+
22+
sql """
23+
create table insert_overwrite_error_message_percent_src (
24+
id int,
25+
d varchar(10)
26+
) engine=olap
27+
duplicate key(id)
28+
distributed by hash(id) buckets 1
29+
properties (
30+
'replication_allocation' = 'tag.location.default: 1'
31+
)
32+
"""
33+
34+
sql """
35+
create table insert_overwrite_error_message_percent_dst (
36+
id int,
37+
ts bigint
38+
) engine=olap
39+
duplicate key(id)
40+
distributed by hash(id) buckets 1
41+
properties (
42+
'replication_allocation' = 'tag.location.default: 1'
43+
)
44+
"""
45+
46+
sql """
47+
insert into insert_overwrite_error_message_percent_src values
48+
(1, '2024-01-01')
49+
"""
50+
51+
test {
52+
sql """
53+
insert overwrite table insert_overwrite_error_message_percent_dst
54+
select id, unix_timestamp(d, 'yyyyMMdd')
55+
from insert_overwrite_error_message_percent_src
56+
"""
57+
exception "Operation unix_timestamp of 2024-01-01, %Y%m%d is invalid"
58+
}
59+
}

0 commit comments

Comments
 (0)