use of com.tencent.angel.ps.storage.partition.ServerPartition in project angel by Tencent.
the class GetNeighborWithByteAttr method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartSampleNeighborWithAttrParam param = (PartSampleNeighborWithAttrParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongAnyRow row = (ServerLongAnyRow) (((RowBasedPartition) part).getRow(0));
long[] nodeIds = param.getNodeIds();
NeighborsAttrsCompressedElement[] elementsCompressed = new NeighborsAttrsCompressedElement[nodeIds.length];
for (int i = 0; i < nodeIds.length; i++) {
long nodeId = nodeIds[i];
// Get node neighbors
NeighborsAttrsCompressedElement elem = (NeighborsAttrsCompressedElement) (row.get(nodeId));
if (elem == null) {
elementsCompressed[i] = null;
} else {
elementsCompressed[i] = elem;
}
}
return new PartGetNeighborWithAttrResult(part.getPartitionKey().getPartitionId(), elementsCompressed);
}
use of com.tencent.angel.ps.storage.partition.ServerPartition in project angel by Tencent.
the class GetNumNeighborEdgesFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartGetNumNeighborEdgesParam param = (PartGetNumNeighborEdgesParam) partParam;
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
ServerLongLongRow row = (ServerLongLongRow) (((RowBasedPartition) part).getRow(0));
long[] nodeIds = param.getNodeIds();
long[] numEdges = new long[nodeIds.length];
for (int i = 0; i < nodeIds.length; i++) {
numEdges[i] = row.get(nodeIds[i]);
}
return new PartGetNumNeighborEdgesResult(part.getPartitionKey().getPartitionId(), numEdges);
}
use of com.tencent.angel.ps.storage.partition.ServerPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSAnyKeyRow.
public static ServerAnyAnyRow getPSAnyKeyRow(PSContext psContext, PartitionGetParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerAnyAnyRow) (((RowBasedPartition) part).getRow(0));
}
use of com.tencent.angel.ps.storage.partition.ServerPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSLongKeyRow.
public static ServerLongAnyRow getPSLongKeyRow(PSContext psContext, PartitionGetParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerLongAnyRow) (((RowBasedPartition) part).getRow(0));
}
use of com.tencent.angel.ps.storage.partition.ServerPartition in project angel by Tencent.
the class GraphMatrixUtils method getPSIntKeyRow.
public static ServerIntAnyRow getPSIntKeyRow(PSContext psContext, PartitionUpdateParam partParam) {
ServerMatrix matrix = psContext.getMatrixStorageManager().getMatrix(partParam.getMatrixId());
ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());
return (ServerIntAnyRow) (((RowBasedPartition) part).getRow(0));
}
Aggregations