use of com.tencent.angel.graph.common.psf.result.GetFloatsResult in project angel by Tencent.
the class GetNodeAttrs method merge.
@Override
public GetResult merge(List<PartitionGetResult> partResults) {
int resultSize = 0;
for (PartitionGetResult result : partResults) {
resultSize += ((PartGeneralGetResult) result).getNodeIds().length;
}
Long2ObjectOpenHashMap<float[]> nodeIdToAttrs = new Long2ObjectOpenHashMap<>(resultSize);
for (PartitionGetResult result : partResults) {
PartGeneralGetResult partResult = (PartGeneralGetResult) result;
long[] nodeIds = partResult.getNodeIds();
IElement[] attrs = partResult.getData();
for (int i = 0; i < nodeIds.length; i++) {
if (attrs[i] != null) {
nodeIdToAttrs.put(nodeIds[i], ((FloatArrayElement) attrs[i]).getData());
} else {
nodeIdToAttrs.put(nodeIds[i], emptyFloats);
}
}
}
return new GetFloatsResult(nodeIdToAttrs);
}
Aggregations