[SPARK-13647] [SQL] also check if numeric value is within allowed range in _verify_type
[SPARK-13647] [SQL] also check if numeric value is within allowed range in _verify_type

## What changes were proposed in this pull request?

This PR makes the `_verify_type` in `types.py` more strict, also check if numeric value is within allowed range.

## How was this patch tested?

newly added doc test.

Author: Wenchen Fan <wenchen@databricks.com>

Closes #11492 from cloud-fan/py-verify.

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