It will be instantiated once per VM, which translates to once per executor.
-kr, Gerard. On Fri, Dec 19, 2014 at 12:21 PM, Ashic Mahtab <as...@live.com> wrote: > > Hi Guys, > Are scala lazy values instantiated once per executor, or once per > partition? For example, if I have: > > object Something = > val lazy context = create() > > def foo(item) = context.doSomething(item) > > and I do > > someRdd.foreach(Something.foo) > > then will context get instantiated once per executor, or once per > partition? > > Thanks, > Ashic. > >