[SPARK-11050] [MLLIB] PySpark SparseVector can return wrong index in e…
[SPARK-11050] [MLLIB] PySpark SparseVector can return wrong index in e…

…rror message

For negative indices in the SparseVector, we update the index value. If we have an incorrect index
at this point, the error message has the incorrect *updated* index instead of the original one. This
change contains the fix for the same.

Author: Bhargav Mangipudi <bhargav.mangipudi@gmail.com>

Closes #9069 from bhargav/spark-10759.

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