Search in sources :

Example 1 with DynamicLongArray

use of com.tencent.angel.common.collections.DynamicLongArray in project angel by Tencent.

the class ReadTag method merge.

@Override
public GetResult merge(List<PartitionGetResult> partResults) {
    DynamicLongArray re = new DynamicLongArray(0);
    for (PartitionGetResult result : partResults) {
        PartReadTagResult partResult = (PartReadTagResult) result;
        long[] nodeIds = partResult.getNodes();
        for (long id : nodeIds) {
            re.add(id);
        }
    }
    return new ReadTagResult(re.getData());
}
Also used : DynamicLongArray(com.tencent.angel.common.collections.DynamicLongArray)

Example 2 with DynamicLongArray

use of com.tencent.angel.common.collections.DynamicLongArray in project angel by Tencent.

the class ReadTag method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    GeneralPartGetParam param = (GeneralPartGetParam) partParam;
    KeyPart keyPart = param.getIndicesPart();
    long[] nodeIds = ((ILongKeyPartOp) keyPart).getKeys();
    ServerLongIntRow row = GraphMatrixUtils.getPSLongKeyIntRow(psContext, param, param.getRowId());
    DynamicLongArray nodes = new DynamicLongArray(nodeIds.length);
    for (int i = 0; i < nodeIds.length; i++) {
        long nodeId = nodeIds[i];
        if (row.get(nodeId) > 0) {
            nodes.add(nodeId);
        }
    }
    return new PartReadTagResult(nodes.getData());
}
Also used : DynamicLongArray(com.tencent.angel.common.collections.DynamicLongArray) KeyPart(com.tencent.angel.psagent.matrix.transport.router.KeyPart) ILongKeyPartOp(com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyPartOp) ServerLongIntRow(com.tencent.angel.ps.storage.vector.ServerLongIntRow)

Aggregations

DynamicLongArray (com.tencent.angel.common.collections.DynamicLongArray)2 ServerLongIntRow (com.tencent.angel.ps.storage.vector.ServerLongIntRow)1 KeyPart (com.tencent.angel.psagent.matrix.transport.router.KeyPart)1 ILongKeyPartOp (com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyPartOp)1