klj218 commented on issue #7429:
URL: https://github.com/apache/seatunnel/issues/7429#issuecomment-2301663511
分析了一下源代码:ElasticsearchRowSerializer.java
2.3.3版本:
private Map<String, Object> toDocumentMap(SeaTunnelRow row) {
String[] fieldNames = seaTunnelRowType.getFieldNames();
Map<String, Object> doc = new HashMap<>(fieldNames.length);
Object[] fields = row.getFields();
for (int i = 0; i < fieldNames.length; i++) {
Object value = fields[i];
if (value instanceof Temporal) {
// jackson not support jdk8 new time api
doc.put(fieldNames[i], value.toString());
} else {
doc.put(fieldNames[i], value);
}
}
return doc;
}
2.3.6版本:
private Map<String, Object> toDocumentMap(SeaTunnelRow row, SeaTunnelRowType
rowType) {
String[] fieldNames = rowType.getFieldNames();
Map<String, Object> doc = new HashMap<>(fieldNames.length);
Object[] fields = row.getFields();
for (int i = 0; i < fieldNames.length; i++) {
Object value = fields[i];
if (value == null) {
} else if (value instanceof SeaTunnelRow) {
doc.put(
fieldNames[i],
toDocumentMap(
(SeaTunnelRow) value, (SeaTunnelRowType)
rowType.getFieldType(i)));
} else {
doc.put(fieldNames[i], convertValue(value));
}
}
return doc;
}
应该就是 if (value == null) {}这里引起的,那如果是这样的话,必须在同步之前强制进行es
mapping提交了,想知道一下这里加null判断的初衷是什么?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]