write it like this

    userOutLinks.mapPartitions { itr =>
      ...
    }

Do the same for "map"