first thing is why? what is the requirement of doing this? if you want to do it for lookup purpose you can pass a broadcast variable and get the values in side the closure. If you want to lookup huge data set joining the dataset is correct rather than executing query inside map tranformation. I haven't tried this but definitely it should be possible from anywhere. But its not advisable to do so.