GitHub user icexelloss opened a pull request:

    https://github.com/apache/spark/pull/21569

    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
    ```
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/icexelloss/spark 
SPARK-24563-fix-pyspark-shell-without-hive

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21569.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21569
    
----
commit 7d5b62858cd3fecbf149b0890d11b23c06356011
Author: Li Jin <ice.xelloss@...>
Date:   2018-06-14T18:52:20Z

    Catch TypeError when testing existence of HiveConf when creating pyspark 
shell

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to