Doris版本 2.1.5
有一个表,表里的字段有这么些
id 主键
test_id not null 普通列
xxxxx 其他列
现在使用 streamload 进行删除数据。streamload 的代码大概如下:
String loadUrl = String.format("http://%s:%s/api/%s/%s/_stream_load",
host, port, database, table);
Map<String, String> headerMap = new HashMap<>(32);
headerMap.put(HttpHeaders.EXPECT, "100-continue");
// 部分更新
headerMap.put("partial_columns", "true");
JsonNode jsonNode = DPUtil.parseJSON(jsonData);
Set<String> strings = DPUtil.fieldsSet(jsonNode);
// 列字段
String columns = CollectionUtil.join(strings, ",", "`","`");
headerMap.put("columns", columns);
headerMap.put(HttpHeaders.AUTHORIZATION, basicAuthHeader(username, password));
headerMap.put("merge_type", "DELETE");
headerMap.put("label", UUID.randomUUID().toString());
headerMap.put("column_separator", ",");
headerMap.put("format", "json");
HttpRequest httpRequest = HttpRequest.put(loadUrl)
.body(jsonData)
.charset(StandardCharsets.UTF_8)
.setFollowRedirects(true)
.removeHeader(HttpHeaders.CONTENT_LENGTH)
.removeHeader(HttpHeaders.TRANSFER_ENCODING)
.headerMap(headerMap, true);
try(HttpResponse execute = httpRequest.execute();){
xxxx
}
删除数据时,使用的数据的主键删除,即:请求的参数仅有主键id : { "id":"1" }
但是有时会出现如下的报错, 提示 test_id 不可为空,并且这个异常,也不是可以稳定复现的:
[CANCELLED][INTERNAL_ERROR]tablet error: [E-207]the unmentioned column test_id
should have default value or be nullable for newly inserted rows in non-strict mode partial update