This is an automated email from the ASF dual-hosted git repository.
jiafengzheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 29fc167548 [Bug](Datax)Fix bug that the dataxwriter will drop column
when convert map to json (#13042)
29fc167548 is described below
commit 29fc167548718c96d59e0a67ec06d32db763bad2
Author: Wilson-β <[email protected]>
AuthorDate: Thu Sep 29 11:37:10 2022 +0800
[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.
---
docs/zh-CN/docs/ecosystem/datax.md | 2 ++
.../com/alibaba/datax/plugin/writer/doriswriter/DorisJsonCodec.java | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/zh-CN/docs/ecosystem/datax.md
b/docs/zh-CN/docs/ecosystem/datax.md
index feb8429d3f..46006122b8 100644
--- a/docs/zh-CN/docs/ecosystem/datax.md
+++ b/docs/zh-CN/docs/ecosystem/datax.md
@@ -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)
diff --git
a/extension/DataX/doriswriter/src/main/java/com/alibaba/datax/plugin/writer/doriswriter/DorisJsonCodec.java
b/extension/DataX/doriswriter/src/main/java/com/alibaba/datax/plugin/writer/doriswriter/DorisJsonCodec.java
index 664b9d3629..063503bbb3 100644
---
a/extension/DataX/doriswriter/src/main/java/com/alibaba/datax/plugin/writer/doriswriter/DorisJsonCodec.java
+++
b/extension/DataX/doriswriter/src/main/java/com/alibaba/datax/plugin/writer/doriswriter/DorisJsonCodec.java
@@ -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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]