spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Pfeiffer <...@preferred.jp>
Subject Re: How to replace user.id to user.names in a file
Date Wed, 07 Jan 2015 02:06:23 GMT
Hi,

On Wed, Jan 7, 2015 at 10:47 AM, Riginos Samaras <samarasriginos@gmail.com>
wrote:

> Yes something like this. Can you please give me an example to create a Map?
>

That depends heavily on the shape of your input file. What about something
like:

(for (line <- Source.fromFile(filename).getLines()) {
  val items = line.trim.split(" ")
  (items(0).toInt, items(1))
}).toMap

Tobias

Mime
View raw message