[Bug](Datax)Fix bug that the dataxwriter will drop column when convert map to json (#13042)
* fix bug that when value is null,toJSONString will drop this key value.
This commit is contained in:
@ -180,6 +180,7 @@ PROPERTIES (
|
||||
"password": "xxx",
|
||||
"postSql": [],
|
||||
"preSql": [],
|
||||
"format":"csv|json",
|
||||
"loadProps": {
|
||||
},
|
||||
"maxBatchRows" : 300000,
|
||||
@ -191,5 +192,6 @@ PROPERTIES (
|
||||
}
|
||||
}
|
||||
```
|
||||
> 注意:```format``` 参数默认值:```csv```,如果想要使用```json```格式,需要在配置中指定```format``` 为```json```.
|
||||
|
||||
4.执行datax任务,具体参考 [datax官网](https://github.com/alibaba/DataX/blob/master/userGuid.md)
|
||||
|
||||
@ -19,6 +19,7 @@ package com.alibaba.datax.plugin.writer.doriswriter;
|
||||
|
||||
import com.alibaba.datax.common.element.Record;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -45,6 +46,6 @@ public class DorisJsonCodec extends DorisCodec {
|
||||
rowMap.put(fieldName, this.convertColumn(row.getColumn(idx)));
|
||||
++idx;
|
||||
}
|
||||
return JSON.toJSONString(rowMap);
|
||||
return JSON.toJSONString(rowMap, SerializerFeature.WriteMapNullValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user