I think she is checking for blanks? But if the RDD is blank then nothing will happen, no db connections etc.
Mayur Rustagi Ph: +1 (760) 203 3257 http://www.sigmoidanalytics.com @mayur_rustagi <https://twitter.com/mayur_rustagi> On Mon, Sep 8, 2014 at 1:32 PM, Tobias Pfeiffer <t...@preferred.jp> wrote: > Hi, > > On Mon, Sep 8, 2014 at 4:39 PM, Sean Owen <so...@cloudera.com> wrote: >> >> > if (rdd.take (1).size == 1) { >> > rdd foreachPartition { iterator => >> > > I was wondering: Since take() is an output operation, isn't it computed > twice (once for the take(1), once during the iteration)? Or will only one > single element be computed for take(1)? > > Thanks > Tobias > > >