Search in sources :

Example 11 with ILongKeyPartOp

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

the class GetHyperLogLog method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    GetHyperLogLogPartParam param = (GetHyperLogLogPartParam) partParam;
    ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
    ILongKeyPartOp keyPart = (ILongKeyPartOp) param.getNodes();
    long[] nodes = keyPart.getKeys();
    Long2ObjectOpenHashMap<HyperLogLogPlus> logs = new Long2ObjectOpenHashMap<>(nodes.length);
    row.startRead(20000);
    try {
        for (int i = 0; i < nodes.length; i++) {
            HyperLogLogPlusElement hllElem = (HyperLogLogPlusElement) row.get(nodes[i]);
            if (hllElem.isActive()) {
                logs.put(nodes[i], hllElem.getHyperLogLogPlus());
            }
        }
    } finally {
        row.endRead();
    }
    return new GetHyperLogLogPartResult(logs);
}
Also used : HyperLogLogPlus(com.clearspring.analytics.stream.cardinality.HyperLogLogPlus) Long2ObjectOpenHashMap(it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow) ILongKeyPartOp(com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyPartOp)

Aggregations

ILongKeyPartOp (com.tencent.angel.psagent.matrix.transport.router.operator.ILongKeyPartOp)11 ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)9 KeyPart (com.tencent.angel.psagent.matrix.transport.router.KeyPart)3 Long2ObjectOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap)3 Tuple3 (scala.Tuple3)2 HyperLogLogPlus (com.clearspring.analytics.stream.cardinality.HyperLogLogPlus)1 DynamicLongArray (com.tencent.angel.common.collections.DynamicLongArray)1 AngelException (com.tencent.angel.exception.AngelException)1 PartGetLongsResult (com.tencent.angel.graph.common.psf.result.PartGetLongsResult)1 PartGeneralGetResult (com.tencent.angel.graph.model.general.get.PartGeneralGetResult)1 TypeNeighborElement (com.tencent.angel.graph.model.neighbor.simplewithtype.TypeNeighborElement)1 IntFloatVector (com.tencent.angel.ml.math2.vector.IntFloatVector)1 MatrixMeta (com.tencent.angel.ml.matrix.MatrixMeta)1 GeneralPartGetParam (com.tencent.angel.ml.matrix.psf.get.base.GeneralPartGetParam)1 ServerLongIntRow (com.tencent.angel.ps.storage.vector.ServerLongIntRow)1 IElement (com.tencent.angel.ps.storage.vector.element.IElement)1 ValuePart (com.tencent.angel.psagent.matrix.transport.router.ValuePart)1 IIntKeyPartOp (com.tencent.angel.psagent.matrix.transport.router.operator.IIntKeyPartOp)1 DoubleValuesPart (com.tencent.angel.psagent.matrix.transport.router.value.DoubleValuesPart)1 FloatValuesPart (com.tencent.angel.psagent.matrix.transport.router.value.FloatValuesPart)1