This commit is contained in:
thinking24k 2025-04-10 16:20:58 +08:00 committed by GitHub
commit fa666eb76d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 126 additions and 119 deletions

View File

@ -86,6 +86,10 @@ MongoDBReader通过Datax框架从MongoDB并行的读取数据通过主控的J
{
"name": "scorec",
"type": "int"
},
{
"name": "appid_list",
"type": "json"
}
]
}
@ -133,17 +137,18 @@ MongoDBReader通过Datax框架从MongoDB并行的读取数据通过主控的J
* typeColumn的类型。【选填】
* splitter因为MongoDB支持数组类型但是Datax框架本身不支持数组类型所以mongoDB读出来的数组类型要通过这个分隔符合并成字符串。【选填】
* query: MongoDB的额外查询条件。【选填】
* json因为MongoDB支持子文档和数组类型子文档但是Datax框架本身不支持所以mongoDB读出来的数据通过JSON序列化成字符串。
#### 5 类型转换
| DataX 内部类型| MongoDB 数据类型 |
| -------- | ----- |
| DataX 内部类型 | MongoDB 数据类型 |
|------------|---------------|
| Long | int, Long |
| Double | double |
| String | string, array |
| Date | date |
| Boolean | boolean |
| Bytes | bytes |
| Object | json |
#### 6 性能报告

View File

@ -173,6 +173,8 @@ public class MongoDBReader extends Reader {
String tempArrayStr = Joiner.on(splitter).join(array);
record.addColumn(new StringColumn(tempArrayStr));
}
}else if ("json".equalsIgnoreCase(column.getString("type"))) {
record.addColumn(new StringColumn(JSON.toJSONString(tempCol)));
} else {
record.addColumn(new StringColumn(tempCol.toString()));
}