提交 74be92d6 编写于 作者: J jiangzhiwen

fix duplicate column names

上级 3259dafa
...@@ -767,11 +767,19 @@ Status CsvOp::ComputeColMap() { ...@@ -767,11 +767,19 @@ Status CsvOp::ComputeColMap() {
for (int32_t i = 0; i < col_names.size(); i++) { for (int32_t i = 0; i < col_names.size(); i++) {
// consider the case of CRLF // consider the case of CRLF
col_names[i].erase(col_names[i].find_last_not_of('\r') + 1); col_names[i].erase(col_names[i].find_last_not_of('\r') + 1);
column_name_id_map_[col_names[i]] = i; if (column_name_id_map_.find(col_names[i]) == column_name_id_map_.end()) {
column_name_id_map_[col_names[i]] = i;
} else {
RETURN_STATUS_UNEXPECTED("Duplicate column names are not allowed");
}
} }
} else { } else {
for (int32_t i = 0; i < column_name_list_.size(); i++) { for (int32_t i = 0; i < column_name_list_.size(); i++) {
column_name_id_map_[column_name_list_[i]] = i; if (column_name_id_map_.find(column_name_list_[i]) == column_name_id_map_.end()) {
column_name_id_map_[column_name_list_[i]] = i;
} else {
RETURN_STATUS_UNEXPECTED("Duplicate column names are not allowed");
}
} }
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册