Search in sources :

Example 1 with ILongKeyLongValuePartOp

use of com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyLongValuePartOp in project angel by Tencent.

the class SampleNeighborWithFilter method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    PartSampleNeighborWithFilterParam sampleParam = (PartSampleNeighborWithFilterParam) partParam;
    ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);
    ILongKeyLongValuePartOp split = (ILongKeyLongValuePartOp) sampleParam.getIndicesToFilterPart();
    long[] nodeIds = split.getKeys();
    long[] filterWithNeighKeys = split.getValues();
    long[] filterWithoutNeighKeys = sampleParam.getFilterWithoutNeighKeys();
    SampleType sampleType = sampleParam.getSampleType();
    switch(sampleType) {
        case NODE:
        case EDGE:
            {
                Tuple2<Long2ObjectOpenHashMap<long[]>, Long2ObjectOpenHashMap<int[]>> nodeId2SampleNeighbors = SampleUtils.sampleWithType(row, nodeIds, sampleType, filterWithNeighKeys, filterWithoutNeighKeys, System.currentTimeMillis());
                return new PartSampleNeighborResultWithType(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors._1, nodeId2SampleNeighbors._2, sampleType);
            }
        default:
            {
                throw new UnsupportedOperationException("Not support sample type " + sampleType + " now");
            }
    }
}
Also used : ILongKeyLongValuePartOp(com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyLongValuePartOp) Tuple2(scala.Tuple2) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Aggregations

ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)1 ILongKeyLongValuePartOp (com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyLongValuePartOp)1 Tuple2 (scala.Tuple2)1