Skip to content

Commit 2af7d26

Browse files
committed
fix schema
1 parent fd89e6d commit 2af7d26

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/query/service/src/interpreters/interpreter_append.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::sync::Arc;
1717
use databend_common_catalog::lock::LockTableOption;
1818
use databend_common_catalog::plan::StageTableInfo;
1919
use databend_common_catalog::table::TableExt;
20+
use databend_common_exception::ErrorCode;
2021
use databend_common_exception::Result;
2122
use databend_common_expression::types::Int32Type;
2223
use databend_common_expression::types::StringType;
@@ -83,6 +84,17 @@ impl Interpreter for AppendInterpreter {
8384
};
8485

8586
target_table.check_mutable()?;
87+
if append
88+
.project_columns
89+
.as_ref()
90+
.is_some_and(|p| p.len() != append.required_source_schema.num_fields())
91+
{
92+
return Err(ErrorCode::BadArguments(format!(
93+
"Fields in select statement is not equal with expected, select fields: {}, insert fields: {}",
94+
append.project_columns.as_ref().unwrap().len(),
95+
append.required_source_schema.num_fields(),
96+
)));
97+
}
8698

8799
// 1. build source and append pipeline
88100
let mut build_res = {

0 commit comments

Comments
 (0)