提交 d95a2e9c 编写于 作者: M ms_yan

repair num of input columns and output columns check

上级 35953fbd
......@@ -51,12 +51,7 @@ Status RenameOp::Builder::Build(std::shared_ptr<RenameOp> *ptr) {
// constructor
RenameOp::RenameOp(const std::vector<std::string> &in_col_names, const std::vector<std::string> &out_col_names,
int32_t op_connector_size)
: PipelineOp(op_connector_size), in_columns_(in_col_names), out_columns_(out_col_names) {
// check input & output sizes
if (in_columns_.size() != out_columns_.size()) {
MS_LOG(ERROR) << "Rename operator number of in columns != number of out columns.";
}
}
: PipelineOp(op_connector_size), in_columns_(in_col_names), out_columns_(out_col_names) {}
// destructor
RenameOp::~RenameOp() {}
......
......@@ -842,6 +842,14 @@ def check_rename(method):
raise ValueError("{} is not provided.".format(param_name))
check_columns(param, param_name)
input_size, output_size = 1, 1
if isinstance(param_dict.get(req_param_columns[0]), list):
input_size = len(param_dict.get(req_param_columns[0]))
if isinstance(param_dict.get(req_param_columns[1]), list):
output_size = len(param_dict.get(req_param_columns[1]))
if input_size != output_size:
raise ValueError("Number of column in input_columns and output_columns is not equal.")
return method(*args, **kwargs)
return new_method
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册