You can add that as part of your RDD, so as output of your map operation
generate the input of your next map operation.. ofcourse the obscure logic
of generating that data has to be map ..
another way is nested def

def factorial(number: Int) : Int = {
    def factorialWithAccumulator(accumulator: Int, number: Int) : Int = {
        if (number == 1)
            return accumulator
        else
            factorialWithAccumulator(accumulator * number, number - 1)
    }
    factorialWithAccumulator(1, number)
 }
 MyRDD.map(factorial(5))



Mayur Rustagi
Ph: +1 (760) 203 3257
http://www.sigmoidanalytics.com
@mayur_rustagi <https://twitter.com/mayur_rustagi>



On Thu, Aug 21, 2014 at 12:03 PM, TJ Klein <tjkl...@gmail.com> wrote:

> Hi,
>
> I am using Spark in Python. I wonder if there is a possibility for passing
> extra arguments to the mapping function. In my scenario, after each map I
> update parameters, which I want to use in the folllowning new iteration of
> mapping. Any idea?
>
> Thanks in advance.
>
> -Tassilo
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Mapping-with-extra-arguments-tp12541.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
> For additional commands, e-mail: user-h...@spark.apache.org
>
>

Reply via email to