Consider there is some connection / external resource allocation required to be accessed/mutated by each of the rows from within a single worker thread.  That connection should only  be opened/closed before the first row is accessed / after the last row is completed.

It is my understanding that there is work presently underway (Reynold Xin and others)  on defining an external resources API to address this. What is the recommended approach in the meanwhile?