Each entry in the RDD is a string. So comparing it to "name" will always fail, as it's "name"+some digits.

What you need is map to iterate over the RDD and return a new value for each entry. And that new value should be the string, without the first 4 characters, and converted to Long.

Putting that all together, we get

name.map(_.drop(4).toLong)

If you don't know the first four characters will be "name", you might want to check that first. What you need then depends on what you want to do with rows that don't have name as the first four, but something like