How could I write the right entry point in Spark 2.0 program (Actually pyspark 2.0)? -


today, wanna try new features spark2.0, here program:

#coding:utf-8 pyspark.conf import sparkconf pyspark.sql import sparksession  spark = sparksession.builder.master("local").appname('test 2.0').config(conf=sparkconf()).getorcreate() df = spark.read.json("/users/lyj/programs/apache/spark2/examples/src/main/resources/people.json") df.show() 

but errors follow:

traceback (most recent call last):   file "/users/lyj/programs/kiseliugit/mypysparkcodes/test/spark2.0.py", line 5, in <module> spark = sparksession.builder.master("local").appname('test 2.0').config(conf=sparkconf()).getorcreate()   file "/users/lyj/programs/apache/spark2/python/pyspark/conf.py", line 104, in __init__ sparkcontext._ensure_initialized()   file "/users/lyj/programs/apache/spark2/python/pyspark/context.py", line 243, in _ensure_initialized sparkcontext._gateway = gateway or launch_gateway()   file "/users/lyj/programs/apache/spark2/python/pyspark/java_gateway.py", line 116, in launch_gateway java_import(gateway.jvm, "org.apache.spark.sparkconf")   file "/library/python/2.7/site-packages/py4j/java_gateway.py", line 90, in java_import return_value = get_return_value(answer, gateway_client, none, none)   file "/library/python/2.7/site-packages/py4j/protocol.py", line 306, in get_return_value value = output_converter[type](answer[2:], gateway_client) keyerror: u'y' 

what's wrong these few lines of codes? have problem java environment? plus, use ide pycharm developing.

try upgrade py4j, pip install py4j --upgrade

it's worked me.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -