[SPARK-22032][PYSPARK] Speed up StructType conversion
[SPARK-22032][PYSPARK] Speed up StructType conversion

## What changes were proposed in this pull request?

StructType.fromInternal is calling f.fromInternal(v) for every field.
We can use precalculated information about type to limit the number of function calls. (its calculated once per StructType and used in per record calculations)

Benchmarks (Python profiler)
```
df = spark.range(10000000).selectExpr("id as id0", "id as id1", "id as id2", "id as id3", "id as id4", "id as id5", "id as id6", "id as id7", "id as id8", "id as id9", "struct(id) as s").cache()
df.count()
df.rdd.map(lambda x: x).count()
```

Before
```
310274584 function calls (300272456 primitive calls) in 1320.684 seconds

Ordered by: internal time, cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 10000000  253.417    0.000  486.991    0.000 types.py:619(<listcomp>)
 30000000  192.272    0.000 1009.986    0.000 types.py:612(fromInternal)
100000000  176.140    0.000  176.140    0.000 types.py:88(fromInternal)
 20000000  156.832    0.000  328.093    0.000 types.py:1471(_create_row)
    14000  107.206    0.008 1237.917    0.088 {built-in method loads}
 20000000   80.176    0.000 1090.162    0.000 types.py:1468(<lambda>)
```

After
```
210274584 function calls (200272456 primitive calls) in 1035.974 seconds

Ordered by: internal time, cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 30000000  215.845    0.000  698.748    0.000 types.py:612(fromInternal)
 20000000  165.042    0.000  351.572    0.000 types.py:1471(_create_row)
    14000  116.834    0.008  946.791    0.068 {built-in method loads}
 20000000   87.326    0.000  786.073    0.000 types.py:1468(<lambda>)
 20000000   85.477    0.000  134.607    0.000 types.py:1519(__new__)
 10000000   65.777    0.000  126.712    0.000 types.py:619(<listcomp>)
```

Main difference is types.py:619(<listcomp>) and types.py:88(fromInternal) (which is removed in After)
The number of function calls is 100 million less. And performance is 20% better.

Benchmark (worst case scenario.)

Test
```
df = spark.range(1000000).selectExpr("current_timestamp as id0", "current_timestamp as id1", "current_timestamp as id2", "current_timestamp as id3", "current_timestamp as id4", "current_timestamp as id5", "current_timestamp as id6", "current_timestamp as id7", "current_timestamp as id8", "current_timestamp as id9").cache()
df.count()
df.rdd.map(lambda x: x).count()
```

Before
```
31166064 function calls (31163984 primitive calls) in 150.882 seconds
```

After
```
31166064 function calls (31163984 primitive calls) in 153.220 seconds
```

IMPORTANT:
The benchmark was done on top of https://github.com/apache/spark/pull/19246.
Without https://github.com/apache/spark/pull/19246 the performance improvement will be even greater.

## How was this patch tested?

Existing tests.
Performance benchmark.

Author: Maciej Bryński <maciek-github@brynski.pl>

Closes #19249 from maver1ck/spark_22032.

facaiy/spark,aosagie/spark,LantaoJin/spark,witgo/spark,techaddict/spark,minixalpha/spark,lxsmnv/spark,tejasapatil/spark,rekhajoshm/spark,caneGuy/spark,debugger87/spark,ueshin/apache-spark,akopich/spark,spark-test/spark,ron8hu/spark,ericvandenbergfb/spark,zero323/spark,JoshRosen/spark,lxsmnv/spark,adrian-ionescu/apache-spark,esi-mineset/spark,caneGuy/spark,holdenk/spark,eyalfa/spark,ioana-delaney/spark,ericvandenbergfb/spark,ericvandenbergfb/spark,hvanhovell/spark,aosagie/spark,mahak/spark,dbtsai/spark,ron8hu/spark,Aegeaner/spark,wzhfy/spark,apache/spark,1haodian/spark,1haodian/spark,pgandhi999/spark,lvdongr/spark,akopich/spark,Aegeaner/spark,WindCanDie/spark,facaiy/spark,WeichenXu123/spark,kevinyu98/spark,nchammas/spark,highfei2011/spark,debugger87/spark,hvanhovell/spark,BryanCutler/spark,icexelloss/spark,esi-mineset/spark,goldmedal/spark,shubhamchopra/spark,jkbradley/spark,caneGuy/spark,LantaoJin/spark,sureshthalamati/spark,WeichenXu123/spark,maropu/spark,WindCanDie/spark,yanboliang/spark,darionyaphet/spark,dongjoon-hyun/spark,shuangshuangwang/spark,ioana-delaney/spark,caneGuy/spark,dongjoon-hyun/spark,zuotingbing/spark,markhamstra/spark,ioana-delaney/spark,zhouyejoe/spark,witgo/spark,lvdongr/spark,zero323/spark,wangmiao1981/spark,adrian-ionescu/apache-spark,pgandhi999/spark,facaiy/spark,wangmiao1981/spark,icexelloss/spark,shaneknapp/spark,LantaoJin/spark,BryanCutler/spark,apache/spark,Aegeaner/spark,adrian-ionescu/apache-spark,ahnqirage/spark,icexelloss/spark,esi-mineset/spark,LantaoJin/spark,ddna1021/spark,nlalevee/spark,sahilTakiar/spark,ueshin/apache-spark,nchammas/spark,zuotingbing/spark,maropu/spark,guoxiaolongzte/spark,taroplus/spark,rekhajoshm/spark,bravo-zhang/spark,tengpeng/spark,bravo-zhang/spark,shuangshuangwang/spark,mdespriee/spark,aray/spark,jiangxb1987/spark,WindCanDie/spark,ericvandenbergfb/spark,goldmedal/spark,jkbradley/spark,bdrillard/spark,vinodkc/spark,taroplus/spark,guoxiaolongzte/spark,highfei2011/spark,1haodian/spark,cin/spark,sureshthalamati/spark,HyukjinKwon/spark,actuaryzhang/spark,tengpeng/spark,ConeyLiu/spark,nlalevee/spark,wangyum/spark,actuaryzhang/spark,gengliangwang/spark,brad-kaiser/spark,rednaxelafx/apache-spark,aray/spark,brad-kaiser/spark,witgo/spark,alunarbeach/spark,ericvandenbergfb/spark,apache/spark,WeichenXu123/spark,1haodian/spark,saltstar/spark,eyalfa/spark,goldmedal/spark,bdrillard/spark,aosagie/spark,JoshRosen/spark,JoshRosen/spark,rednaxelafx/apache-spark,cloud-fan/spark,hvanhovell/spark,tengpeng/spark,nlalevee/spark,saltstar/spark,nchammas/spark,minixalpha/spark,szhem/spark,kevinyu98/spark,witgo/spark,rikima/spark,rednaxelafx/apache-spark,szhem/spark,cin/spark,cin/spark,eyalfa/spark,Aegeaner/spark,dbtsai/spark,debugger87/spark,mdespriee/spark,shuangshuangwang/spark,nlalevee/spark,rezasafi/spark,sureshthalamati/spark,shubhamchopra/spark,skonto/spark,mahak/spark,srowen/spark,lvdongr/spark,sureshthalamati/spark,michalsenkyr/spark,alunarbeach/spark,tengpeng/spark,nlalevee/spark,rednaxelafx/apache-spark,zuotingbing/spark,taroplus/spark,xuanyuanking/spark,goldmedal/spark,markhamstra/spark,ptkool/spark,skonto/spark,esi-mineset/spark,hvanhovell/spark,wangyum/spark,xuanyuanking/spark,yanboliang/spark,techaddict/spark,highfei2011/spark,nlalevee/spark,HyukjinKwon/spark,akopich/spark,taroplus/spark,alunarbeach/spark,akopich/spark,cloud-fan/spark,lxsmnv/spark,actuaryzhang/spark,skonto/spark,adrian-ionescu/apache-spark,WeichenXu123/spark,srowen/spark,bravo-zhang/spark,WindCanDie/spark,rednaxelafx/apache-spark,srowen/spark,milliman/spark,adrian-ionescu/apache-spark,zuotingbing/spark,gengliangwang/spark,vinodkc/spark,WeichenXu123/spark,tejasapatil/spark,milliman/spark,ConeyLiu/spark,ron8hu/spark,saltstar/spark,adrian-ionescu/apache-spark,highfei2011/spark,actuaryzhang/spark,aosagie/spark,joseph-torres/spark,ddna1021/spark,zuotingbing/spark,szhem/spark,zhouyejoe/spark,apache/spark,rezasafi/spark,gengliangwang/spark,yanboliang/spark,bdrillard/spark,rezasafi/spark,ahnqirage/spark,jiangxb1987/spark,gengliangwang/spark,kiszk/spark,caneGuy/spark,markhamstra/spark,markhamstra/spark,cloud-fan/spark,holdenk/spark,guoxiaolongzte/spark,jiangxb1987/spark,caneGuy/spark,ahnqirage/spark,alunarbeach/spark,kevinyu98/spark,hhbyyh/spark,ahnqirage/spark,mdespriee/spark,darionyaphet/spark,yanboliang/spark,alunarbeach/spark,kiszk/spark,ron8hu/spark,shubhamchopra/spark,akopich/spark,hhbyyh/spark,szhem/spark,lxsmnv/spark,ron8hu/spark,maropu/spark,shaneknapp/spark,rezasafi/spark,hvanhovell/spark,shuangshuangwang/spark,ahnqirage/spark,jiangxb1987/spark,chuckchen/spark,zero323/spark,spark-test/spark,srowen/spark,cin/spark,xuanyuanking/spark,xuanyuanking/spark,ddna1021/spark,nchammas/spark,WindCanDie/spark,tejasapatil/spark,wzhfy/spark,skonto/spark,eyalfa/spark,HyukjinKwon/spark,BryanCutler/spark,ConeyLiu/spark,saltstar/spark,ueshin/apache-spark,rednaxelafx/apache-spark,alunarbeach/spark,rikima/spark,jkbradley/spark,witgo/spark,debugger87/spark,brad-kaiser/spark,zzcclp/spark,vinodkc/spark,tejasapatil/spark,joseph-torres/spark,bdrillard/spark,kiszk/spark,adrian-ionescu/apache-spark,jiangxb1987/spark,guoxiaolongzte/spark,facaiy/spark,rikima/spark,milliman/spark,gengliangwang/spark,zero323/spark,ioana-delaney/spark,ddna1021/spark,1haodian/spark,JoshRosen/spark,zzcclp/spark,zero323/spark,michalsenkyr/spark,mahak/spark,apache/spark,brad-kaiser/spark,tejasapatil/spark,apache/spark,rikima/spark,brad-kaiser/spark,rekhajoshm/spark,rednaxelafx/apache-spark,zhouyejoe/spark,dongjoon-hyun/spark,lvdongr/spark,guoxiaolongzte/spark,cloud-fan/spark,wangmiao1981/spark,shaneknapp/spark,brad-kaiser/spark,srowen/spark,goldmedal/spark,minixalpha/spark,ioana-delaney/spark,milliman/spark,shuangshuangwang/spark,cin/spark,shaneknapp/spark,vinodkc/spark,rezasafi/spark,dbtsai/spark,JoshRosen/spark,BryanCutler/spark,zzcclp/spark,guoxiaolongzte/spark,dongjoon-hyun/spark,minixalpha/spark,lxsmnv/spark,WeichenXu123/spark,lvdongr/spark,mdespriee/spark,techaddict/spark,vinodkc/spark,WindCanDie/spark,darionyaphet/spark,1haodian/spark,facaiy/spark,wangmiao1981/spark,hhbyyh/spark,ueshin/apache-spark,icexelloss/spark,shubhamchopra/spark,kevinyu98/spark,hvanhovell/spark,tejasapatil/spark,wzhfy/spark,esi-mineset/spark,gengliangwang/spark,ioana-delaney/spark,witgo/spark,zhouyejoe/spark,taroplus/spark,bravo-zhang/spark,bdrillard/spark,dbtsai/spark,mahak/spark,guoxiaolongzte/spark,michalsenkyr/spark,rikima/spark,aray/spark,kiszk/spark,holdenk/spark,WindCanDie/spark,szhem/spark,icexelloss/spark,dbtsai/spark,cloud-fan/spark,facaiy/spark,jiangxb1987/spark,akopich/spark,HyukjinKwon/spark,HyukjinKwon/spark,tengpeng/spark,highfei2011/spark,rekhajoshm/spark,Aegeaner/spark,jkbradley/spark,ddna1021/spark,icexelloss/spark,zhouyejoe/spark,ddna1021/spark,taroplus/spark,ptkool/spark,ptkool/spark,sahilTakiar/spark,minixalpha/spark,joseph-torres/spark,shubhamchopra/spark,witgo/spark,kiszk/spark,rikima/spark,WeichenXu123/spark,ueshin/apache-spark,JoshRosen/spark,zzcclp/spark,joseph-torres/spark,icexelloss/spark,skonto/spark,hvanhovell/spark,ConeyLiu/spark,techaddict/spark,saltstar/spark,yanboliang/spark,maropu/spark,LantaoJin/spark,rekhajoshm/spark,sureshthalamati/spark,skonto/spark,ptkool/spark,zhouyejoe/spark,mdespriee/spark,ron8hu/spark,brad-kaiser/spark,wangyum/spark,eyalfa/spark,caneGuy/spark,tejasapatil/spark,chuckchen/spark,minixalpha/spark,mdespriee/spark,dongjoon-hyun/spark,ioana-delaney/spark,eyalfa/spark,cloud-fan/spark,mahak/spark,saltstar/spark,ptkool/spark,kevinyu98/spark,lvdongr/spark,spark-test/spark,pgandhi999/spark,ueshin/apache-spark,chuckchen/spark,bravo-zhang/spark,gengliangwang/spark,dbtsai/spark,spark-test/spark,shaneknapp/spark,rikima/spark,alunarbeach/spark,maropu/spark,szhem/spark,1haodian/spark,pgandhi999/spark,sureshthalamati/spark,holdenk/spark,sahilTakiar/spark,sahilTakiar/spark,shubhamchopra/spark,shaneknapp/spark,milliman/spark,kiszk/spark,bravo-zhang/spark,Aegeaner/spark,akopich/spark,mahak/spark,vinodkc/spark,kevinyu98/spark,ptkool/spark,actuaryzhang/spark,sahilTakiar/spark,zero323/spark,HyukjinKwon/spark,dbtsai/spark,kevinyu98/spark,milliman/spark,aray/spark,LantaoJin/spark,holdenk/spark,yanboliang/spark,milliman/spark,rezasafi/spark,wzhfy/spark,facaiy/spark,BryanCutler/spark,mahak/spark,eyalfa/spark,zzcclp/spark,ahnqirage/spark,skonto/spark,zzcclp/spark,chuckchen/spark,michalsenkyr/spark,shaneknapp/spark,BryanCutler/spark,jkbradley/spark,lvdongr/spark,lxsmnv/spark,bdrillard/spark,xuanyuanking/spark,dongjoon-hyun/spark,debugger87/spark,aosagie/spark,shuangshuangwang/spark,actuaryzhang/spark,michalsenkyr/spark,cin/spark,dongjoon-hyun/spark,ddna1021/spark,debugger87/spark,spark-test/spark,spark-test/spark,zzcclp/spark,BryanCutler/spark,Aegeaner/spark,jiangxb1987/spark,chuckchen/spark,joseph-torres/spark,tengpeng/spark,apache/spark,debugger87/spark,wangyum/spark,ron8hu/spark,LantaoJin/spark,chuckchen/spark,srowen/spark,shubhamchopra/spark,ptkool/spark,hhbyyh/spark,ueshin/apache-spark,michalsenkyr/spark,sahilTakiar/spark,nlalevee/spark,holdenk/spark,wangmiao1981/spark,ConeyLiu/spark,wangmiao1981/spark,ahnqirage/spark,joseph-torres/spark,nchammas/spark,sureshthalamati/spark,markhamstra/spark,rekhajoshm/spark,szhem/spark,hhbyyh/spark,techaddict/spark,joseph-torres/spark,jkbradley/spark,darionyaphet/spark,darionyaphet/spark,nchammas/spark,pgandhi999/spark,maropu/spark,wzhfy/spark,ConeyLiu/spark,highfei2011/spark,xuanyuanking/spark,maropu/spark,wangmiao1981/spark,spark-test/spark,esi-mineset/spark,goldmedal/spark,esi-mineset/spark,techaddict/spark,cin/spark,highfei2011/spark,michalsenkyr/spark,bdrillard/spark,aray/spark,wzhfy/spark,pgandhi999/spark,yanboliang/spark,wangyum/spark,saltstar/spark,darionyaphet/spark,shuangshuangwang/spark,chuckchen/spark,zero323/spark,wangyum/spark,aosagie/spark,aray/spark,cloud-fan/spark,mdespriee/spark,markhamstra/spark,lxsmnv/spark,goldmedal/spark,holdenk/spark,sahilTakiar/spark,hhbyyh/spark,pgandhi999/spark,xuanyuanking/spark,ConeyLiu/spark,HyukjinKwon/spark,rekhajoshm/spark,nchammas/spark,zuotingbing/spark,rezasafi/spark,actuaryzhang/spark,minixalpha/spark,zuotingbing/spark,srowen/spark,JoshRosen/spark,hhbyyh/spark,taroplus/spark,ericvandenbergfb/spark,matthewfranglen/spark,aray/spark,vinodkc/spark,darionyaphet/spark,wangyum/spark,jkbradley/spark,bravo-zhang/spark,kiszk/spark,techaddict/spark,aosagie/spark,tengpeng/spark,wzhfy/spark,markhamstra/spark,ericvandenbergfb/spark,zhouyejoe/spark