Skip to content

Commit

Permalink
[INLONG-11105][SDK] Fix the empty string is converted into a "null"
Browse files Browse the repository at this point in the history
  • Loading branch information
vernedeng committed Sep 14, 2024
1 parent 807717a commit 1410146
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public List<O> transform(I input, Map<String, Object> extParams) {
for (ValueParserNode node : this.selectItems) {
String fieldName = node.getFieldName();
ValueParser parser = node.getParser();
if (parser == null || StringUtils.equals(fieldName, SinkEncoder.ALL_SOURCE_FIELD_SIGN)) {
if (parser == null && StringUtils.equals(fieldName, SinkEncoder.ALL_SOURCE_FIELD_SIGN)) {
if (input instanceof String) {
sinkData.addField(fieldName, (String) input);
} else {
Expand All @@ -177,7 +177,11 @@ public List<O> transform(I input, Map<String, Object> extParams) {
}
try {
Object fieldValue = parser.parse(sourceData, i, context);
sinkData.addField(fieldName, String.valueOf(fieldValue));
if (fieldValue == null) {
sinkData.addField(fieldName, "");
} else {
sinkData.addField(fieldName, fieldValue.toString());
}
} catch (Throwable t) {
sinkData.addField(fieldName, "");
}
Expand Down

0 comments on commit 1410146

Please sign in to comment.