in adb2client/src/main/java/com/alibaba/cloud/analyticdb/adbclient/AdbClient.java [1256:1291]
private Row mapToRow(String tableName, Map<String, String> dataMap) {
Row row = new Row();
int i = 0;
if (this.isAllColumn.get(tableName)) {
for (ColumnInfo ci : this.tableInfo.get(tableName).getColumns()) {
if (dataMap.get(ci.getName()) != null) {
row.setColumn(i, dataMap.get(ci.getName()));
dataMap.remove(ci.getName());
} else {
if (!ci.isNullable()) {
throw new AdbClientException(AdbClientException.CONFIG_ERROR, String.format("The column %s of table %s can not be null", ci.getName(), tableName), null);
}
row.setColumn(i, ci.getDefaultValue());
}
i++;
}
} else {
for (String col : this.databaseConfig.getColumns(tableName)) {
if (dataMap.get(col) != null) {
row.setColumn(i, dataMap.get(col));
dataMap.remove(col);
} else {
for (ColumnInfo ci : this.tableInfo.get(tableName).getColumns()) {
if (ci.getName().equalsIgnoreCase(col)) {
if (!ci.isNullable()) {
throw new AdbClientException(AdbClientException.CONFIG_ERROR, String.format("The column %s of table %s can not be null", ci.getName(), tableName), null);
}
row.setColumn(i, ci.getDefaultValue());
}
}
}
i++;
}
}
return row;
}