admin管理员组文章数量:1389882
I am working on Hazelcast jet application and I trying to join two Sources using Left, Right or Inner Join with large data but I am stuck at below: Here is my code:
BatchStage<Map<String,Object>> batch1= pipeline.readFrom(companyListBatchSource);
BatchStage<Map<String,Object>> batch2= pipeline.readFrom(employeeListBatchSource);
//Getting group by key
BatchStageWithKey<Map<String,Object>, Object> jdbcGroupByKey = batch1.groupingKey(a -> a.getSource1().get(col1));
BatchStageWithKey<Map<String,Object>, Object> fileGroupByKey = batch2.groupingKey(b -> b.getSource1().get(col2));
BatchStage<Entry<Object, Tuple2<List<Map<String,Object>>, List<Map<String,Object>>>>> d = jdbcGroupByKey.aggregate2(AggregateOperations.toList(),fileGroupByKey,AggregateOperations.toList());
BatchStage<List<Object>> jdbcBatchStageData = d.filter(h -> {
return !h.getValue().f0().isEmpty() && !h.getValue().f1().isEmpty();
}).map(e -> {
try {
List<Object> list = new ArrayList<Object>();
e.getValue().f0().forEach(z -> {
if (e.getValue().f1().size() > 0) {
e.getValue().f1().forEach(z1 -> {
List<Object> a = new ArrayList<Object>();
a.addAll((List<Object>)z);
a.addAll((List<Object>)z1);
list.add(a);
});
}
});
return list;
} catch (Exception e1) {
return null;
}
});
This work fine but if there is large data than it gets out pf memory because of this line:
BatchStage<Entry<Object, Tuple2<List<Map<String,Object>>, List<Map<String,Object>>>>> d = jdbcGroupByKey.aggregate2(AggregateOperations.toList(),fileGroupByKey,AggregateOperations.toList());
SO what I need that somehow I write this into file and read that file in streaming so it won't affect memory, yes it will be slow but won't go out of memory.
WOuld be great if someone can help.
本文标签: javaJoin large data in Hazelcast JetStack Overflow
版权声明:本文标题:java - Join large data in Hazelcast Jet - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744646322a2617420.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论