加强属性列和源数据列的校验,不匹配直接失败

This commit is contained in:
FuYouJ 2023-07-07 21:00:42 +08:00
parent dc77fc11a1
commit cc90994e17

View File

@ -198,13 +198,14 @@ public class Neo4jClient {
private MapValue checkAndConvert(Record record) {
int sourceColNum = record.getColumnNumber();
List<Neo4jProperty> neo4JProperties = writeConfig.neo4jProperties;
int len = Math.min(sourceColNum, neo4JProperties.size());
Map<String, Value> data = new HashMap<>(len * 4 / 3);
for (int i = 0; i < len; i++) {
List<Neo4jProperty> neo4jProperties = writeConfig.neo4jProperties;
if (neo4jProperties == null || neo4jProperties.size() != sourceColNum){
throw new DataXException(Neo4jErrorCode.CONFIG_INVALID,"the read and write columns do not match!");
}
Map<String, Value> data = new HashMap<>(sourceColNum * 4 / 3);
for (int i = 0; i < sourceColNum; i++) {
Column column = record.getColumn(i);
Neo4jProperty neo4jProperty = neo4JProperties.get(i);
Neo4jProperty neo4jProperty = neo4jProperties.get(i);
try {
Value value = ValueAdapter.column2Value(column, neo4jProperty);