[SPARK-5440][pyspark] Add toLocalIterator to pyspark rdd
[SPARK-5440][pyspark] Add toLocalIterator to pyspark rdd

Since Java and Scala both have access to iterate over partitions via the "toLocalIterator" function, python should also have that same ability.

Author: Michael Nazario <mnazario@palantir.com>

Closes #4237 from mnazario/feature/toLocalIterator and squashes the following commits:

1c58526 [Michael Nazario] Fix documentation off by one error
0cdc8f8 [Michael Nazario] Add toLocalIterator to PySpark

nilsgrabbert/spark,huang1900/spark,sureshthalamati/spark,cloud-fan/spark,janewangfb/spark,icexelloss/spark,facaiy/spark,narahari92/spark,joseph-torres/spark,markhamstra/spark,rezasafi/spark,ptkool/spark,jkbradley/spark,spark-test/spark,akopich/spark,jiangxb1987/spark,wangmiao1981/spark,xuanyuanking/spark,milliman/spark,techaddict/spark,jlopezmalla/spark,szhem/spark,ron8hu/spark,nilsgrabbert/spark,Aegeaner/spark,sahilTakiar/spark,cloud-fan/spark,andrewor14/iolap,lxsmnv/spark,techaddict/spark,highfei2011/spark,LantaoJin/spark,loneknightpy/spark,mahak/spark,esi-mineset/spark,stanzhai/spark,pronix/spark,zero323/spark,janewangfb/spark,spark-test/spark,map222/spark,michalsenkyr/spark,liutang123/spark,MLnick/spark,bOOm-X/spark,nchammas/spark,tengpeng/spark,map222/spark,aray/spark,janewangfb/spark,mike0sv/spark,wzhfy/spark,mahak/spark,tejasapatil/spark,jkbradley/spark,chuckchen/spark,milliman/spark,michalsenkyr/spark,vinodkc/spark,WeichenXu123/spark,poffuomo/spark,MLnick/spark,yanboliang/spark,saltstar/spark,adrian-ionescu/apache-spark,wangyum/spark,dhruve/spark,liutang123/spark,shaneknapp/spark,someorz/spark,loneknightpy/spark,rikima/spark,dbtsai/spark,facaiy/spark,aray/spark,Aegeaner/spark,shubhamchopra/spark,bravo-zhang/spark,stanzhai/spark,zzcclp/spark,cin/spark,ron8hu/spark,milliman/spark,kissmetrics/spark,ajaysaini725/spark,panfengfeng/spark,ptkool/spark,SHASHANKB/spark,maropu/spark,joseph-torres/spark,jrshust/spark,zero323/spark,WeichenXu123/spark,byakuinss/spark,chuckchen/spark,zzcclp/spark,aray/spark,adrian-ionescu/apache-spark,mike0sv/spark,debugger87/spark,rikima/spark,goldmedal/spark,srowen/spark,wzhfy/spark,rikima/spark,zhouyejoe/spark,panfengfeng/spark,eyalfa/spark,cloud-fan/spark,srowen/spark,setjet/spark,ConeyLiu/spark,xflin/spark,huang1900/spark,andrewor14/iolap,dongjoon-hyun/spark,goldmedal/spark,dhruve/spark,stanzhai/spark,ddna1021/spark,patrick-nicholson/spark,brad-kaiser/spark,Panos-Bletsos/spark-cost-model-optimizer,facaiy/spark,cloud-fan/spark,sachintyagi22/spark,witgo/spark,nchammas/spark,JoshRosen/spark,esi-mineset/spark,Aegeaner/spark,gioenn/xSpark,mdespriee/spark,sahilTakiar/spark,srowen/spark,taroplus/spark,aosagie/spark,kiszk/spark,techaddict/spark,ioana-delaney/spark,jiangxb1987/spark,wangyum/spark,janewangfb/spark,eyalfa/spark,rednaxelafx/apache-spark,saturday-shi/spark,sahilTakiar/spark,BryanCutler/spark,ConeyLiu/spark,mdespriee/spark,JoshRosen/spark,kevinyu98/spark,markhamstra/spark,debugger87/spark,big-pegasus/spark,UndeadBaneGitHub/spark,rezasafi/spark,facaiy/spark,haowu80s/spark,vinodkc/spark,andrewor14/spark,jianran/spark,hvanhovell/spark,lvdongr/spark,pgandhi999/spark,huang1900/spark,xuanyuanking/spark,ConeyLiu/spark,apache-spark-on-k8s/spark,Aegeaner/spark,aokolnychyi/spark,saltstar/spark,bOOm-X/spark,icexelloss/spark,caneGuy/spark,srowen/spark,guoxiaolongzte/spark,1haodian/spark,nlalevee/spark,wangmiao1981/spark,vinodkc/spark,cin/spark,facaiy/spark,bravo-zhang/spark,JoshRosen/spark,hhbyyh/spark,eyalfa/spark,lxsmnv/spark,mdespriee/spark,rednaxelafx/apache-spark,gioenn/xSpark,skonto/spark,narahari92/spark,jlopezmalla/spark,someorz/spark,adrian-ionescu/apache-spark,narahari92/spark,mike0sv/spark,ericvandenbergfb/spark,esi-mineset/spark,zuotingbing/spark,gengliangwang/spark,vinodkc/spark,lvdongr/spark,JoshRosen/spark,kimoonkim/spark,darionyaphet/spark,haowu80s/spark,ptkool/spark,kevinyu98/spark,ron8hu/spark,tejasapatil/spark,kissmetrics/spark,icexelloss/spark,JerryLead/spark,cin/spark,adrian-ionescu/apache-spark,ConeyLiu/spark,big-pegasus/spark,apache-spark-on-k8s/spark,WindCanDie/spark,alunarbeach/spark,sahilTakiar/spark,alunarbeach/spark,ajaysaini725/spark,shaneknapp/spark,markhamstra/spark,kiszk/spark,ddna1021/spark,hvanhovell/spark,map222/spark,stanzhai/spark,szhem/spark,jrshust/spark,metamx/spark,tengpeng/spark,1haodian/spark,HyukjinKwon/spark,patrick-nicholson/spark,LantaoJin/spark,pronix/spark,ahnqirage/spark,liutang123/spark,saturday-shi/spark,BryanCutler/spark,darionyaphet/spark,dongjoon-hyun/spark,kissmetrics/spark,liyichao/spark,goldmedal/spark,liyichao/spark,mahak/spark,hvanhovell/spark,hvanhovell/spark,1haodian/spark,1haodian/spark,ioana-delaney/spark,alunarbeach/spark,ConeyLiu/spark,techaddict/spark,saltstar/spark,facaiy/spark,maropu/spark,ibm-research-ireland/sparkoscope,apache/spark,haowu80s/spark,someorz/spark,witgo/spark,nlalevee/spark,setjet/spark,minixalpha/spark,aokolnychyi/spark,ibm-research-ireland/sparkoscope,debugger87/spark,sureshthalamati/spark,apache/spark,metamx/spark,witgo/spark,spark-test/spark,ptkool/spark,mike0sv/spark,liyichao/spark,setjet/spark,xflin/spark,gioenn/xSpark,mike0sv/spark,xuanyuanking/spark,hvanhovell/spark,shubhamchopra/spark,hhbyyh/spark,shaneknapp/spark,setjet/spark,loneknightpy/spark,minixalpha/spark,bravo-zhang/spark,chuckchen/spark,stanzhai/spark,ajaysaini725/spark,BryanCutler/spark,adrian-ionescu/apache-spark,lxsmnv/spark,holdenk/spark,saltstar/spark,bdrillard/spark,jrshust/spark,SnappyDataInc/spark,map222/spark,metamx/spark,rekhajoshm/spark,eyalfa/spark,stanzhai/spark,brad-kaiser/spark,dongjoon-hyun/spark,cloud-fan/spark,WindCanDie/spark,ajaysaini725/spark,jkbradley/spark,esi-mineset/spark,map222/spark,stanzhai/spark,jiangxb1987/spark,jianran/spark,tejasapatil/spark,jlopezmalla/spark,zhouyejoe/spark,maropu/spark,gengliangwang/spark,caneGuy/spark,saturday-shi/spark,UndeadBaneGitHub/spark,spark-test/spark,panfengfeng/spark,darionyaphet/spark,aosagie/spark,xuanyuanking/spark,jrshust/spark,dbtsai/spark,milliman/spark,kimoonkim/spark,ioana-delaney/spark,MLnick/spark,byakuinss/spark,ericvandenbergfb/spark,rekhajoshm/spark,ericvandenbergfb/spark,jlopezmalla/spark,gengliangwang/spark,aosagie/spark,apache-spark-on-k8s/spark,jrshust/spark,akopich/spark,dongjoon-hyun/spark,dbtsai/spark,mdespriee/spark,zzcclp/spark,sachintyagi22/spark,HyukjinKwon/spark,ddna1021/spark,ueshin/apache-spark,yanboliang/spark,sachintyagi22/spark,actuaryzhang/spark,wzhfy/spark,joseph-torres/spark,jianran/spark,SHASHANKB/spark,pgandhi999/spark,mahak/spark,skonto/spark,zuotingbing/spark,ahnqirage/spark,aosagie/spark,jrshust/spark,huang1900/spark,caneGuy/spark,bOOm-X/spark,yanboliang/spark,zzcclp/spark,tejasapatil/spark,ueshin/apache-spark,saltstar/spark,cin/spark,liutang123/spark,techaddict/spark,narahari92/spark,saturday-shi/spark,matthewfranglen/spark,xflin/spark,LantaoJin/spark,pgandhi999/spark,sachintyagi22/spark,vinodkc/spark,zero323/spark,michalsenkyr/spark,ddna1021/spark,brad-kaiser/spark,ajaysaini725/spark,andrewor14/spark,JerryLead/spark,HyukjinKwon/spark,ueshin/apache-spark,witgo/spark,poffuomo/spark,narahari92/spark,techaddict/spark,ueshin/apache-spark,guoxiaolongzte/spark,poffuomo/spark,liutang123/spark,aray/spark,tengpeng/spark,setjet/spark,zero323/spark,zero323/spark,shuangshuangwang/spark,huang1900/spark,someorz/spark,big-pegasus/spark,janewangfb/spark,srowen/spark,wangmiao1981/spark,Panos-Bletsos/spark-cost-model-optimizer,andrewor14/spark,goldmedal/spark,minixalpha/spark,bdrillard/spark,ddna1021/spark,dongjoon-hyun/spark,highfei2011/spark,dbtsai/spark,caneGuy/spark,wzhfy/spark,SHASHANKB/spark,wangmiao1981/spark,shubhamchopra/spark,shubhamchopra/spark,pgandhi999/spark,BryanCutler/spark,jkbradley/spark,mike0sv/spark,rikima/spark,pronix/spark,publicRoman/spark,kevinyu98/spark,highfei2011/spark,metamx/spark,aokolnychyi/spark,HyukjinKwon/spark,akopich/spark,ron8hu/spark,WeichenXu123/spark,actuaryzhang/spark,Panos-Bletsos/spark-cost-model-optimizer,liutang123/spark,bravo-zhang/spark,kiszk/spark,wangmiao1981/spark,patrick-nicholson/spark,BryanCutler/spark,joseph-torres/spark,markhamstra/spark,shuangshuangwang/spark,aray/spark,haowu80s/spark,kiszk/spark,kevinyu98/spark,SnappyDataInc/spark,patrick-nicholson/spark,taroplus/spark,sureshthalamati/spark,SnappyDataInc/spark,nlalevee/spark,zuotingbing/spark,dongjoon-hyun/spark,rezasafi/spark,WindCanDie/spark,apache-spark-on-k8s/spark,publicRoman/spark,rekhajoshm/spark,taroplus/spark,vinodkc/spark,bOOm-X/spark,szhem/spark,joseph-torres/spark,yanboliang/spark,ibm-research-ireland/sparkoscope,nchammas/spark,byakuinss/spark,lvdongr/spark,JoshRosen/spark,SnappyDataInc/spark,1haodian/spark,apache-spark-on-k8s/spark,lvdongr/spark,zzcclp/spark,ioana-delaney/spark,gengliangwang/spark,bravo-zhang/spark,mahak/spark,icexelloss/spark,big-pegasus/spark,holdenk/spark,markhamstra/spark,someorz/spark,michalsenkyr/spark,nchammas/spark,narahari92/spark,hhbyyh/spark,panfengfeng/spark,WindCanDie/spark,alunarbeach/spark,kimoonkim/spark,adrian-ionescu/apache-spark,gengliangwang/spark,shuangshuangwang/spark,zero323/spark,zhouyejoe/spark,mzl9039/spark,cin/spark,tejasapatil/spark,actuaryzhang/spark,jrshust/spark,ron8hu/spark,wangmiao1981/spark,mzl9039/spark,haowu80s/spark,loneknightpy/spark,mzl9039/spark,UndeadBaneGitHub/spark,apache/spark,chuckchen/spark,michalsenkyr/spark,akopich/spark,jlopezmalla/spark,zzcclp/spark,LantaoJin/spark,maropu/spark,sahilTakiar/spark,publicRoman/spark,nlalevee/spark,eyalfa/spark,andrewor14/iolap,setjet/spark,ibm-research-ireland/sparkoscope,dbtsai/spark,brad-kaiser/spark,gioenn/xSpark,ericvandenbergfb/spark,rikima/spark,SHASHANKB/spark,bOOm-X/spark,nilsgrabbert/spark,patrick-nicholson/spark,wzhfy/spark,goldmedal/spark,andrewor14/iolap,gioenn/xSpark,hhbyyh/spark,bdrillard/spark,ConeyLiu/spark,Aegeaner/spark,huang1900/spark,pgandhi999/spark,rednaxelafx/apache-spark,skonto/spark,MLnick/spark,bdrillard/spark,lxsmnv/spark,bOOm-X/spark,yanboliang/spark,rednaxelafx/apache-spark,metamx/spark,rikima/spark,skonto/spark,bdrillard/spark,liyichao/spark,guoxiaolongzte/spark,tengpeng/spark,xuanyuanking/spark,dhruve/spark,nchammas/spark,facaiy/spark,WindCanDie/spark,setjet/spark,cin/spark,HyukjinKwon/spark,shubhamchopra/spark,UndeadBaneGitHub/spark,someorz/spark,ericvandenbergfb/spark,LantaoJin/spark,nchammas/spark,jkbradley/spark,spark-test/spark,witgo/spark,icexelloss/spark,poffuomo/spark,lxsmnv/spark,nilsgrabbert/spark,zhouyejoe/spark,dbtsai/spark,shuangshuangwang/spark,pronix/spark,mahak/spark,debugger87/spark,chuckchen/spark,1haodian/spark,eyalfa/spark,andrewor14/iolap,kevinyu98/spark,shuangshuangwang/spark,xflin/spark,witgo/spark,ioana-delaney/spark,debugger87/spark,nlalevee/spark,zhouyejoe/spark,shaneknapp/spark,aokolnychyi/spark,andrewor14/spark,dbtsai/spark,guoxiaolongzte/spark,jiangxb1987/spark,shubhamchopra/spark,jkbradley/spark,publicRoman/spark,kissmetrics/spark,szhem/spark,ibm-research-ireland/sparkoscope,ioana-delaney/spark,JerryLead/spark,taroplus/spark,wangyum/spark,panfengfeng/spark,ptkool/spark,map222/spark,minixalpha/spark,zhouyejoe/spark,esi-mineset/spark,holdenk/spark,kissmetrics/spark,apache-spark-on-k8s/spark,ahnqirage/spark,zuotingbing/spark,zuotingbing/spark,JoshRosen/spark,byakuinss/spark,rekhajoshm/spark,chuckchen/spark,joseph-torres/spark,actuaryzhang/spark,andrewor14/iolap,WeichenXu123/spark,panfengfeng/spark,nchammas/spark,apache/spark,saltstar/spark,pgandhi999/spark,nilsgrabbert/spark,JerryLead/spark,hhbyyh/spark,rekhajoshm/spark,adrian-ionescu/apache-spark,zhouyejoe/spark,zuotingbing/spark,aray/spark,dhruve/spark,gengliangwang/spark,mdespriee/spark,Aegeaner/spark,mzl9039/spark,dongjoon-hyun/spark,patrick-nicholson/spark,maropu/spark,kimoonkim/spark,michalsenkyr/spark,liyichao/spark,SnappyDataInc/spark,holdenk/spark,ibm-research-ireland/sparkoscope,nilsgrabbert/spark,dhruve/spark,cin/spark,ahnqirage/spark,cloud-fan/spark,HyukjinKwon/spark,liyichao/spark,WeichenXu123/spark,byakuinss/spark,LantaoJin/spark,wangmiao1981/spark,dhruve/spark,kevinyu98/spark,caneGuy/spark,map222/spark,yanboliang/spark,ptkool/spark,milliman/spark,kiszk/spark,milliman/spark,minixalpha/spark,cloud-fan/spark,skonto/spark,BryanCutler/spark,gioenn/xSpark,caneGuy/spark,srowen/spark,esi-mineset/spark,ajaysaini725/spark,ueshin/apache-spark,xuanyuanking/spark,rezasafi/spark,kissmetrics/spark,mahak/spark,jianran/spark,michalsenkyr/spark,ddna1021/spark,kissmetrics/spark,JoshRosen/spark,holdenk/spark,aokolnychyi/spark,UndeadBaneGitHub/spark,BryanCutler/spark,mike0sv/spark,ron8hu/spark,hhbyyh/spark,1haodian/spark,apache-spark-on-k8s/spark,guoxiaolongzte/spark,MLnick/spark,SnappyDataInc/spark,rezasafi/spark,MLnick/spark,apache/spark,highfei2011/spark,sureshthalamati/spark,eyalfa/spark,pronix/spark,hhbyyh/spark,debugger87/spark,huang1900/spark,wangyum/spark,jlopezmalla/spark,aosagie/spark,kimoonkim/spark,sachintyagi22/spark,SnappyDataInc/spark,liutang123/spark,spark-test/spark,JerryLead/spark,mzl9039/spark,ibm-research-ireland/sparkoscope,mdespriee/spark,saturday-shi/spark,tejasapatil/spark,shaneknapp/spark,tengpeng/spark,jianran/spark,nlalevee/spark,jlopezmalla/spark,ptkool/spark,jianran/spark,goldmedal/spark,saturday-shi/spark,SHASHANKB/spark,minixalpha/spark,milliman/spark,aosagie/spark,saltstar/spark,publicRoman/spark,ajaysaini725/spark,darionyaphet/spark,jiangxb1987/spark,ueshin/apache-spark,actuaryzhang/spark,shaneknapp/spark,holdenk/spark,pgandhi999/spark,shuangshuangwang/spark,sahilTakiar/spark,patrick-nicholson/spark,xflin/spark,bdrillard/spark,ron8hu/spark,szhem/spark,sachintyagi22/spark,byakuinss/spark,SHASHANKB/spark,janewangfb/spark,big-pegasus/spark,taroplus/spark,darionyaphet/spark,loneknightpy/spark,wangyum/spark,sureshthalamati/spark,highfei2011/spark,loneknightpy/spark,rezasafi/spark,joseph-torres/spark,techaddict/spark,tejasapatil/spark,ahnqirage/spark,WindCanDie/spark,haowu80s/spark,bOOm-X/spark,rednaxelafx/apache-spark,maropu/spark,UndeadBaneGitHub/spark,sahilTakiar/spark,gioenn/xSpark,icexelloss/spark,metamx/spark,kimoonkim/spark,bdrillard/spark,taroplus/spark,dhruve/spark,minixalpha/spark,ueshin/apache-spark,tengpeng/spark,gengliangwang/spark,taroplus/spark,poffuomo/spark,zero323/spark,szhem/spark,Panos-Bletsos/spark-cost-model-optimizer,sachintyagi22/spark,alunarbeach/spark,lxsmnv/spark,liyichao/spark,sureshthalamati/spark,darionyaphet/spark,aosagie/spark,chuckchen/spark,alunarbeach/spark,darionyaphet/spark,brad-kaiser/spark,wangyum/spark,caneGuy/spark,big-pegasus/spark,lvdongr/spark,rednaxelafx/apache-spark,tengpeng/spark,LantaoJin/spark,kimoonkim/spark,bravo-zhang/spark,jianran/spark,maropu/spark,lvdongr/spark,icexelloss/spark,brad-kaiser/spark,SHASHANKB/spark,andrewor14/spark,wzhfy/spark,kevinyu98/spark,hvanhovell/spark,skonto/spark,witgo/spark,publicRoman/spark,holdenk/spark,actuaryzhang/spark,pronix/spark,wzhfy/spark,janewangfb/spark,byakuinss/spark,mzl9039/spark,guoxiaolongzte/spark,Aegeaner/spark,highfei2011/spark,lxsmnv/spark,debugger87/spark,ericvandenbergfb/spark,yanboliang/spark,alunarbeach/spark,rekhajoshm/spark,WeichenXu123/spark,sureshthalamati/spark,guoxiaolongzte/spark,goldmedal/spark,wangyum/spark,aokolnychyi/spark,spark-test/spark,poffuomo/spark,esi-mineset/spark,shuangshuangwang/spark,bravo-zhang/spark,aokolnychyi/spark,ericvandenbergfb/spark,akopich/spark,zuotingbing/spark,kiszk/spark,ConeyLiu/spark,jiangxb1987/spark,ahnqirage/spark,metamx/spark,rednaxelafx/apache-spark,rekhajoshm/spark,ioana-delaney/spark,markhamstra/spark,apache/spark,saturday-shi/spark,highfei2011/spark,JerryLead/spark,andrewor14/spark,rezasafi/spark,loneknightpy/spark,hvanhovell/spark,vinodkc/spark,actuaryzhang/spark,zzcclp/spark,xflin/spark,skonto/spark,panfengfeng/spark,lvdongr/spark,UndeadBaneGitHub/spark,mzl9039/spark,xuanyuanking/spark,nlalevee/spark,aray/spark,jiangxb1987/spark,rikima/spark,WeichenXu123/spark,szhem/spark,big-pegasus/spark,poffuomo/spark,MLnick/spark,markhamstra/spark,andrewor14/spark,Panos-Bletsos/spark-cost-model-optimizer,publicRoman/spark,andrewor14/iolap,srowen/spark,someorz/spark,xflin/spark,shubhamchopra/spark,apache/spark,akopich/spark,HyukjinKwon/spark,Panos-Bletsos/spark-cost-model-optimizer,WindCanDie/spark,akopich/spark,narahari92/spark,jkbradley/spark,ahnqirage/spark,kiszk/spark,JerryLead/spark,nilsgrabbert/spark,shaneknapp/spark,Panos-Bletsos/spark-cost-model-optimizer,mdespriee/spark,ddna1021/spark,brad-kaiser/spark