2015-08-25 87 views
2

首先,我開始在火花的節儉服務器。 /sbin/start-thriftserver.sh 和deamon開始。火花不支持的方法

hadoop 13015  1 99 13:52 pts/1 00:00:09 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java -cp /home/hadoop/spark/lib/hive-jdbc-0.13.0.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/sbin/../conf/:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/spark-assembly-1.4.1-hadoop2.6.0.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-core-3.2.10.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-api-jdo-3.2.6.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-rdbms-3.2.9.jar 
-Xms512m -Xmx512m -XX:MaxPermSize=256m org.apache.spark.deploy.SparkSubmit --class org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 spark-internal 

後,我開始/bin/pyspark

我的蜂巢版本是0.13.1,

火花版本是1.4.1,

的Hadoop版本是2.7

火花類路徑下面。

SPARK_CLASSPATH = /home/account/spark/lib/hive-jdbc-0.13.0.jar: /home/account/spark/lib/hive-exec-0.13.0.jar: /家/account/spark/lib/hive-metastore-0.13.0.jar: /home/account/spark/lib/hive-service-0.13.0.jar: /home/account/spark/lib/libfb303-0.9 .0.jar: /home/account/spark/lib/log4j-1.2.16.jar

在pyspark(蟒蛇殼),我寫了這個代碼。

>>> df = sqlContext.load(source="jdbc",driver="org.apache.hive.jdbc.HiveDriver", url="jdbc:hive2://IP:10000/default", dbtable="default.test")

,但它不工作,我得到這個錯誤。我該如何解決這個錯誤?

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/dev/user/ja/spark/python/pyspark/sql/context.py", line 458, in load 
    return self.read.load(path, source, schema, **options) 
    File "/home/dev/user/ja/spark/python/pyspark/sql/readwriter.py", line 112, in load 
    return self._df(self._jreader.load()) 
    File "/home/dev/user/ja/spark/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 538, in __call__ 
    File "/home/dev/user/ja/spark/python/lib/py4j-0.8.2.1-src.zip/py4j/protocol.py", line 300, in get_return_value 
py4j.protocol.Py4JJavaError: An error occurred while calling o29.load. 
: java.sql.SQLException: Method not supported 
     at org.apache.hive.jdbc.HiveResultSetMetaData.isSigned(HiveResultSetMetaData.java:141) 
     at org.apache.spark.sql.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:132) 
     at org.apache.spark.sql.jdbc.JDBCRelation.<init>(JDBCRelation.scala:128) 
     at org.apache.spark.sql.jdbc.DefaultSource.createRelation(JDBCRelation.scala:113) 
     at org.apache.spark.sql.sources.ResolvedDataSource$.apply(ddl.scala:269) 
     at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:114) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:601) 
     at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231) 
     at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379) 
     at py4j.Gateway.invoke(Gateway.java:259) 
     at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133) 
     at py4j.commands.CallCommand.execute(CallCommand.java:79) 
     at py4j.GatewayConnection.run(GatewayConnection.java:207) 
     at java.lang.Thread.run(Thread.java:722) 

我認爲在蜂箱不支持HiveResultSetMetaData.isSigned方法。 但我不知道如何解決此錯誤。請幫忙..

謝謝

回答

1

這是不確定的。但我回答了我的問題。

我覺得它是由版本引起的。 當我執行下面的命令時,我得到「方法不支持」錯誤。

但是,當我在spark-1.3.1這個命令,它的工作。

>>> df = sqlContext.load(source="jdbc",driver="org.apache.hive.jdbc.HiveDriver", url="jdbc:hive2://IP:10000/default", dbtable="default.test")

所以我覺得問題是版本。

但這是我的猜測。

此頁面可能對您有所幫助。 http://docs.hortonworks.com/HDPDocuments/HDP1/HDP-1.2.4/ds_Hive/jdbc-hs2.html