use of com.tencent.angel.ps.storage.vector.storage.IntElementMapStorage in project angel by Tencent.
the class ComplexRowFormat method save.
private void save(ServerIntAnyRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta partMeta, DataOutputStream output) throws IOException {
IntElementStorage storage = row.getStorage();
long startPos = partMeta.getStartCol();
if (storage instanceof IntArrayElementStorage) {
IElement[] data = ((IntArrayElementStorage) storage).getData();
for (int i = 0; i < data.length; i++) {
save(i + startPos, data[i], output);
}
} else if (storage instanceof IntElementMapStorage) {
Int2ObjectOpenHashMap<IElement> data = ((IntElementMapStorage) storage).getData();
ObjectIterator<Int2ObjectMap.Entry<IElement>> iter = data.int2ObjectEntrySet().fastIterator();
while (iter.hasNext()) {
Int2ObjectMap.Entry<IElement> entry = iter.next();
save(entry.getIntKey() + startPos, entry.getValue(), output);
}
}
}
Aggregations