Py4JJavaError: An error occurred while calling o18.sql. : java.lang.RuntimeException:

来源:互联网 发布:linux图形化界面命令 编辑:程序博客网 时间:2024/04/30 20:52
from pyspark import SparkContextfrom pyspark import HiveContext,SQLContextif __name__ == "__main__":        sc = SparkContext(appName = "test")        sqlContext = HiveContext(sc)        print "**************"        table_df = sqlContext.sql("select * from test")        print "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"        table_df.cache()        print table_df.count()        sc.stop()        print "*******end***************************************"

spark单独运行正常运行,用到HiveSpark报如下错误:

Traceback (most recent call last):
  File "/home/sky/spark/bin/workspace/demo.py", line 9, in <module>
    table_df = sqlContext.sql("select * from test")
  File "/home/sky/spark/python/pyspark/sql/context.py", line 488, in sql
    return DataFrame(self._ssql_ctx.sql(sqlQuery), self)
  File "/home/sky/spark/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 538, in __call__
  File "/home/sky/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 o18.sql.
: java.lang.RuntimeException: java.io.IOException: Permission denied
 at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:330)
 at org.apache.spark.sql.hive.HiveContext.sessionState$lzycompute(HiveContext.scala:239)
 at org.apache.spark.sql.hive.HiveContext.sessionState(HiveContext.scala:235)
 at org.apache.spark.sql.hive.HiveContext.hiveconf$lzycompute(HiveContext.scala:251)
 at org.apache.spark.sql.hive.HiveContext.hiveconf(HiveContext.scala:250)
 at org.apache.spark.sql.hive.HiveContext.sql(HiveContext.scala:95)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497)
 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:745)
Caused by: java.io.IOException: Permission denied
 at java.io.UnixFileSystem.createFileExclusively(Native Method)
 at java.io.File.createTempFile(File.java:2024)
 at org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:432)
 at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:328)
 ... 16 more


1 0
原创粉丝点击