pyspark - Can't create a DataFrame in spark? -


i'm trying familiar spark @ of their examples , getting started tutorials. want load text file contains 2 columns of numbers seperated tab , create dataframe that. hoping using commands below:

>>> data = sc.textfile("amazon.txt") >>> df = data.map(lambda r: [int(x) x in r.split("\t")]) >>> df = df.todf() 

but when execute last command throws error:

u'unable locate hive jars connect metastore. please set spark.sql.hive.metastore.jars.' 

full stack trace:

traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "/spark-2.0.1-bin-hadoop2.7/python/pyspark/sql/session.py", line 57, in todf     return sparksession.createdataframe(self, schema, sampleratio)   file "/spark-2.0.1-bin-hadoop2.7/python/pyspark/sql/session.py", line 526, in createdataframe     jdf = self._jsparksession.applyschematopythonrdd(jrdd.rdd(), schema.json())   file "/spark-2.0.1-bin-hadoop2.7/python/lib/py4j-0.10.3-src.zip/py4j/java_gateway.py", line 1133, in __call__   file "/spark-2.0.1-bin-hadoop2.7/python/pyspark/sql/utils.py", line 79, in deco     raise illegalargumentexception(s.split(': ', 1)[1], stacktrace) pyspark.sql.utils.illegalargumentexception: u'unable locate hive jars connect metastore. please set spark.sql.hive.metastore.jars.' 

based on erorr message looks need set called spark.sql.hive.metastore.jars, don't know or set it.

can point me in right direction issue resolved can create data frame?

if using spark version 1.5 or later there possibility may have multiple or wrong version of spark.sql.hive.metastore.jars

you can add below setting $spark_home/conf/spark_defaults.conf

spark.sql.hive.metastore.version x.x.x

spark.sql.hive.metastore.jars maven

if set spark.sql.hive.metastore.jars maven appropriate jars downloaded , added classpath. can set normal java classpath /usr/hive/lib/:/usr/hadoop/lib/

hope helps.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -