[SPARK-6603] [PySpark] [SQL] add SQLContext.udf and deprecate inferSchema() and applySchema
[SPARK-6603] [PySpark] [SQL] add SQLContext.udf and deprecate inferSchema() and applySchema

This PR create an alias for `registerFunction` as `udf.register`, to be consistent with Scala API.

It also deprecated inferSchema() and applySchema(), show an warning for them.

cc rxin

Author: Davies Liu <davies@databricks.com>

Closes #5273 from davies/udf and squashes the following commits:

476e947 [Davies Liu] address comments
c096fdb [Davies Liu] add SQLContext.udf and deprecate inferSchema() and applySchema

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