[SPARK-24563][PYTHON] Catch TypeError when testing existence of HiveConf when creating pysp…
[SPARK-24563][PYTHON] Catch TypeError when testing existence of HiveConf when creating pysp…

…ark shell

## What changes were proposed in this pull request?

This PR catches TypeError when testing existence of HiveConf when creating pyspark shell

## How was this patch tested?

Manually tested. Here are the manual test cases:

Build with hive:
```
(pyarrow-dev) Lis-MacBook-Pro:spark icexelloss$ bin/pyspark
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:44:09)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
18/06/14 14:55:41 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 2.4.0-SNAPSHOT
      /_/

Using Python version 3.6.5 (default, Apr  6 2018 13:44:09)
SparkSession available as 'spark'.
>>> spark.conf.get('spark.sql.catalogImplementation')
'hive'
```

Build without hive:
```
(pyarrow-dev) Lis-MacBook-Pro:spark icexelloss$ bin/pyspark
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:44:09)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
18/06/14 15:04:52 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 2.4.0-SNAPSHOT
      /_/

Using Python version 3.6.5 (default, Apr  6 2018 13:44:09)
SparkSession available as 'spark'.
>>> spark.conf.get('spark.sql.catalogImplementation')
'in-memory'
```

Failed to start shell:
```
(pyarrow-dev) Lis-MacBook-Pro:spark icexelloss$ bin/pyspark
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:44:09)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
18/06/14 15:07:53 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
/Users/icexelloss/workspace/spark/python/pyspark/shell.py:45: UserWarning: Failed to initialize Spark session.
  warnings.warn("Failed to initialize Spark session.")
Traceback (most recent call last):
  File "/Users/icexelloss/workspace/spark/python/pyspark/shell.py", line 41, in <module>
    spark = SparkSession._create_shell_session()
  File "/Users/icexelloss/workspace/spark/python/pyspark/sql/session.py", line 581, in _create_shell_session
    return SparkSession.builder.getOrCreate()
  File "/Users/icexelloss/workspace/spark/python/pyspark/sql/session.py", line 168, in getOrCreate
    raise py4j.protocol.Py4JError("Fake Py4JError")
py4j.protocol.Py4JError: Fake Py4JError
(pyarrow-dev) Lis-MacBook-Pro:spark icexelloss$
```

Author: Li Jin <ice.xelloss@gmail.com>

Closes #21569 from icexelloss/SPARK-24563-fix-pyspark-shell-without-hive.

ConeyLiu/spark,HyukjinKwon/spark,ueshin/apache-spark,ueshin/apache-spark,xuanyuanking/spark,srowen/spark,hhbyyh/spark,goldmedal/spark,sahilTakiar/spark,ahnqirage/spark,icexelloss/spark,mahak/spark,wzhfy/spark,zero323/spark,tengpeng/spark,gengliangwang/spark,shuangshuangwang/spark,eyalfa/spark,taroplus/spark,shaneknapp/spark,rednaxelafx/apache-spark,zuotingbing/spark,aosagie/spark,caneGuy/spark,taroplus/spark,bdrillard/spark,vinodkc/spark,jiangxb1987/spark,yanboliang/spark,guoxiaolongzte/spark,lxsmnv/spark,mahak/spark,shaneknapp/spark,ptkool/spark,WindCanDie/spark,tejasapatil/spark,nchammas/spark,sahilTakiar/spark,darionyaphet/spark,icexelloss/spark,gengliangwang/spark,vinodkc/spark,zhouyejoe/spark,dongjoon-hyun/spark,wzhfy/spark,kiszk/spark,michalsenkyr/spark,maropu/spark,mdespriee/spark,rekhajoshm/spark,wangyum/spark,mdespriee/spark,jkbradley/spark,rikima/spark,pgandhi999/spark,dbtsai/spark,milliman/spark,techaddict/spark,jkbradley/spark,dongjoon-hyun/spark,cloud-fan/spark,hvanhovell/spark,bdrillard/spark,zhouyejoe/spark,ConeyLiu/spark,wzhfy/spark,kiszk/spark,dongjoon-hyun/spark,Aegeaner/spark,WeichenXu123/spark,michalsenkyr/spark,mdespriee/spark,bravo-zhang/spark,BryanCutler/spark,ptkool/spark,zzcclp/spark,LantaoJin/spark,vinodkc/spark,shuangshuangwang/spark,shuangshuangwang/spark,rikima/spark,rezasafi/spark,zzcclp/spark,ueshin/apache-spark,caneGuy/spark,xuanyuanking/spark,Aegeaner/spark,yanboliang/spark,darionyaphet/spark,zero323/spark,michalsenkyr/spark,zhouyejoe/spark,debugger87/spark,goldmedal/spark,zhouyejoe/spark,wangmiao1981/spark,hhbyyh/spark,bravo-zhang/spark,BryanCutler/spark,tejasapatil/spark,guoxiaolongzte/spark,zero323/spark,kiszk/spark,wangyum/spark,tejasapatil/spark,shaneknapp/spark,apache/spark,spark-test/spark,apache/spark,xuanyuanking/spark,WindCanDie/spark,rekhajoshm/spark,BryanCutler/spark,taroplus/spark,debugger87/spark,vinodkc/spark,apache/spark,rikima/spark,ptkool/spark,zhouyejoe/spark,zuotingbing/spark,JoshRosen/spark,kevinyu98/spark,LantaoJin/spark,wzhfy/spark,skonto/spark,highfei2011/spark,holdenk/spark,hhbyyh/spark,lvdongr/spark,ConeyLiu/spark,rekhajoshm/spark,zzcclp/spark,nchammas/spark,xuanyuanking/spark,xuanyuanking/spark,eyalfa/spark,debugger87/spark,wangmiao1981/spark,zhouyejoe/spark,WindCanDie/spark,tejasapatil/spark,techaddict/spark,srowen/spark,zzcclp/spark,icexelloss/spark,witgo/spark,JoshRosen/spark,shaneknapp/spark,highfei2011/spark,ConeyLiu/spark,techaddict/spark,Aegeaner/spark,highfei2011/spark,spark-test/spark,rikima/spark,srowen/spark,ueshin/apache-spark,bravo-zhang/spark,aosagie/spark,Aegeaner/spark,lxsmnv/spark,rednaxelafx/apache-spark,cloud-fan/spark,BryanCutler/spark,aosagie/spark,holdenk/spark,hvanhovell/spark,skonto/spark,chuckchen/spark,holdenk/spark,yanboliang/spark,rekhajoshm/spark,BryanCutler/spark,rezasafi/spark,witgo/spark,tejasapatil/spark,apache/spark,LantaoJin/spark,hhbyyh/spark,pgandhi999/spark,facaiy/spark,wzhfy/spark,facaiy/spark,rikima/spark,WeichenXu123/spark,highfei2011/spark,bdrillard/spark,tengpeng/spark,hhbyyh/spark,icexelloss/spark,jiangxb1987/spark,HyukjinKwon/spark,yanboliang/spark,wzhfy/spark,bravo-zhang/spark,kevinyu98/spark,hvanhovell/spark,kevinyu98/spark,gengliangwang/spark,milliman/spark,rednaxelafx/apache-spark,mdespriee/spark,ptkool/spark,facaiy/spark,michalsenkyr/spark,actuaryzhang/spark,gengliangwang/spark,witgo/spark,LantaoJin/spark,sahilTakiar/spark,srowen/spark,highfei2011/spark,srowen/spark,BryanCutler/spark,dbtsai/spark,milliman/spark,mahak/spark,wangmiao1981/spark,hvanhovell/spark,tengpeng/spark,zzcclp/spark,wangyum/spark,WeichenXu123/spark,michalsenkyr/spark,shaneknapp/spark,mahak/spark,witgo/spark,cloud-fan/spark,zero323/spark,rednaxelafx/apache-spark,maropu/spark,skonto/spark,apache/spark,jkbradley/spark,rezasafi/spark,jkbradley/spark,WindCanDie/spark,darionyaphet/spark,pgandhi999/spark,milliman/spark,ptkool/spark,debugger87/spark,JoshRosen/spark,aosagie/spark,facaiy/spark,dongjoon-hyun/spark,zuotingbing/spark,lvdongr/spark,zzcclp/spark,pgandhi999/spark,WeichenXu123/spark,rednaxelafx/apache-spark,ahnqirage/spark,aosagie/spark,techaddict/spark,lxsmnv/spark,spark-test/spark,kevinyu98/spark,ptkool/spark,ueshin/apache-spark,lvdongr/spark,bdrillard/spark,eyalfa/spark,sahilTakiar/spark,spark-test/spark,facaiy/spark,maropu/spark,gengliangwang/spark,bravo-zhang/spark,actuaryzhang/spark,dbtsai/spark,spark-test/spark,tengpeng/spark,mdespriee/spark,shuangshuangwang/spark,maropu/spark,Aegeaner/spark,gengliangwang/spark,chuckchen/spark,lvdongr/spark,HyukjinKwon/spark,michalsenkyr/spark,actuaryzhang/spark,wangyum/spark,eyalfa/spark,xuanyuanking/spark,rezasafi/spark,ahnqirage/spark,kiszk/spark,darionyaphet/spark,lxsmnv/spark,debugger87/spark,JoshRosen/spark,guoxiaolongzte/spark,eyalfa/spark,bdrillard/spark,WindCanDie/spark,LantaoJin/spark,skonto/spark,ConeyLiu/spark,yanboliang/spark,goldmedal/spark,wangmiao1981/spark,caneGuy/spark,hvanhovell/spark,wangmiao1981/spark,wangyum/spark,dongjoon-hyun/spark,gengliangwang/spark,Aegeaner/spark,xuanyuanking/spark,hhbyyh/spark,rezasafi/spark,rednaxelafx/apache-spark,sahilTakiar/spark,vinodkc/spark,vinodkc/spark,ConeyLiu/spark,dbtsai/spark,ptkool/spark,cloud-fan/spark,wzhfy/spark,nchammas/spark,highfei2011/spark,actuaryzhang/spark,ahnqirage/spark,ahnqirage/spark,jiangxb1987/spark,dongjoon-hyun/spark,icexelloss/spark,darionyaphet/spark,srowen/spark,shuangshuangwang/spark,techaddict/spark,facaiy/spark,spark-test/spark,rekhajoshm/spark,tengpeng/spark,holdenk/spark,witgo/spark,JoshRosen/spark,caneGuy/spark,jkbradley/spark,actuaryzhang/spark,taroplus/spark,apache/spark,zero323/spark,vinodkc/spark,pgandhi999/spark,lvdongr/spark,rekhajoshm/spark,lvdongr/spark,skonto/spark,chuckchen/spark,goldmedal/spark,jiangxb1987/spark,debugger87/spark,goldmedal/spark,zuotingbing/spark,JoshRosen/spark,ueshin/apache-spark,matthewfranglen/spark,taroplus/spark,chuckchen/spark,goldmedal/spark,cloud-fan/spark,darionyaphet/spark,eyalfa/spark,WeichenXu123/spark,maropu/spark,witgo/spark,shaneknapp/spark,guoxiaolongzte/spark,mahak/spark,milliman/spark,lxsmnv/spark,chuckchen/spark,tengpeng/spark,BryanCutler/spark,jkbradley/spark,apache/spark,shuangshuangwang/spark,milliman/spark,rezasafi/spark,bdrillard/spark,witgo/spark,holdenk/spark,sahilTakiar/spark,HyukjinKwon/spark,kevinyu98/spark,darionyaphet/spark,lxsmnv/spark,caneGuy/spark,mdespriee/spark,rekhajoshm/spark,kiszk/spark,aosagie/spark,taroplus/spark,shaneknapp/spark,WindCanDie/spark,michalsenkyr/spark,wangyum/spark,highfei2011/spark,jkbradley/spark,mahak/spark,kevinyu98/spark,dbtsai/spark,ConeyLiu/spark,nchammas/spark,pgandhi999/spark,rezasafi/spark,skonto/spark,tengpeng/spark,Aegeaner/spark,holdenk/spark,guoxiaolongzte/spark,mdespriee/spark,zuotingbing/spark,WeichenXu123/spark,debugger87/spark,zero323/spark,yanboliang/spark,chuckchen/spark,facaiy/spark,kevinyu98/spark,yanboliang/spark,dbtsai/spark,kiszk/spark,dongjoon-hyun/spark,aosagie/spark,guoxiaolongzte/spark,maropu/spark,HyukjinKwon/spark,mahak/spark,zhouyejoe/spark,srowen/spark,zero323/spark,skonto/spark,techaddict/spark,milliman/spark,dbtsai/spark,zuotingbing/spark,wangmiao1981/spark,ueshin/apache-spark,maropu/spark,WeichenXu123/spark,nchammas/spark,sahilTakiar/spark,WindCanDie/spark,cloud-fan/spark,HyukjinKwon/spark,hvanhovell/spark,tejasapatil/spark,bravo-zhang/spark,nchammas/spark,zzcclp/spark,kiszk/spark,cloud-fan/spark,rikima/spark,icexelloss/spark,eyalfa/spark,HyukjinKwon/spark,hhbyyh/spark,icexelloss/spark,jiangxb1987/spark,JoshRosen/spark,rednaxelafx/apache-spark,ahnqirage/spark,jiangxb1987/spark,bdrillard/spark,hvanhovell/spark,techaddict/spark,guoxiaolongzte/spark,actuaryzhang/spark,ahnqirage/spark,shuangshuangwang/spark,bravo-zhang/spark,pgandhi999/spark,holdenk/spark,jiangxb1987/spark,zuotingbing/spark,goldmedal/spark,spark-test/spark,lxsmnv/spark,nchammas/spark,caneGuy/spark,caneGuy/spark,actuaryzhang/spark,rikima/spark,wangmiao1981/spark,lvdongr/spark,tejasapatil/spark,wangyum/spark,taroplus/spark,chuckchen/spark,LantaoJin/spark,LantaoJin/spark