[SPARK-11904][PYSPARK] reduceByKeyAndWindow does not require checkpointing when invFunc is None
[SPARK-11904][PYSPARK] reduceByKeyAndWindow does not require checkpointing when invFunc is None

when invFunc is None, `reduceByKeyAndWindow(func, None, winsize, slidesize)` is equivalent to

     reduceByKey(func).window(winsize, slidesize).reduceByKey(winsize, slidesize)

and no checkpoint is necessary. The corresponding Scala code does exactly that, but Python code always creates a windowed stream with obligatory checkpointing. The patch fixes this.

I do not know how to unit-test this.

Author: David Tolpin <david.tolpin@gmail.com>

Closes #9888 from dtolpin/master.

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