in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/AdbClient.java [122:135]
private void checkPut(Put put) throws AdbClientException {
if (put == null) {
throw new AdbClientException(ExceptionCode.CONSTRAINT_VIOLATION, "Put cannot be null");
}
for (int index : put.getRecord().getKeyIndex()) {
if ((!put.getRecord().isSet(index) || null == put.getRecord().getObject(index)) && put.getRecord().getSchema().getColumn(index).getDefaultValue() == null) {
throw new AdbClientWithDetailsException(ExceptionCode.CONSTRAINT_VIOLATION, "Put primary key cannot be null:" + put.getRecord().getSchema().getColumnSchema()[index].getName(), put.getRecord());
}
}
if (put.getRecord().getSchema().isPartitionParentTable() && (!put.getRecord().isSet(put.getRecord().getSchema().getPartitionIndex()) || null == put.getRecord().getObject(put.getRecord().getSchema().getPartitionIndex()))) {
throw new AdbClientWithDetailsException(ExceptionCode.CONSTRAINT_VIOLATION, "Put partition key cannot be null:" + put.getRecord().getSchema().getColumnSchema()[put.getRecord().getSchema().getPartitionIndex()].getName(), put.getRecord());
}
}