spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Pfeiffer <...@preferred.jp>
Subject Re: about write mongodb in mapPartitions
Date Fri, 07 Nov 2014 10:04:13 GMT
Hi,

On Fri, Nov 7, 2014 at 6:23 PM, qinwei <wei.qin@dewmobile.net> wrote:
>
>             args.map(arg => {
>                 coll.insert(new BasicDBObject("pkg", arg))
>                 arg
>             })
>
>             mongoClient.close()
>             args
>

As the results of args.map are never used anywhere, I think the loop body
is not executed at all. Maybe try:

            val argsProcessed = args.map(arg => {
                coll.insert(new BasicDBObject("pkg", arg))
                arg
            })

            mongoClient.close()
            argsProcessed

Tobias

Mime
View raw message