【问题标题】:Running SparkR through RStudio通过 RStudio 运行 SparkR
【发布时间】:2016-12-21 09:01:49
【问题描述】:

我使用下面的链接来学习如何通过 RStudio 运行 SparkR:

http://blog.danielemaasit.com/2015/07/26/installing-and-starting-sparkr-locally-on-windows-8-1-and-rstudio/

我在第 4.5 节遇到问题。

if (nchar(Sys.getenv("SPARK_HOME")) < 1) {
  Sys.setenv(SPARK_HOME = "C:/Apache/spark-2.0.0")
}
library(SparkR, lib.loc = c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib")))
sparkR.session(master = "local[*]", sparkConfig = list(spark.driver.memory = "1g"))

library(SparkR)
sc<-sparkR.session(master = "local")
sqlContext <- sparkRSQL.init(sc)

DF <- createDataFrame(sqlContext, faithful)

Error comes up when I run the DF function: 

Error in invokeJava(isStatic = TRUE, className, methodName, ...) : 
  java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.apache.spark.sql.hive.client.IsolatedClientLoader.createClient(IsolatedClientLoader.scala:258)
    at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:359)
    at org.apache.spark.sql.hive.HiveUtils$.newClientForMetadata(HiveUtils.scala:263)
    at org.apache.spark.sql.hive.HiveSharedState.metadataHive$lzycompute(HiveSharedState.scala:39)
    at org.apache.spark.sql.hive.HiveSharedState.metadataHive(HiveSharedState.scala:38)
    at org.apache.spark.sql.hive.HiveSharedState.externalCatalog$lzycompute(HiveSharedState.scala:46)
    at org.apache.spark.sql.hive.HiveSharedState.externalCatalog(HiveSharedState.scala:45)
    at org.a
In addition: Warning message:
'createDataFrame(sqlContext...)' is deprecated.
Use 'createDataFrame(data, schema = NULL, samplingRatio = 1.0)' instead.
See help("Deprecated") 

我真的不知道错误是什么,任何帮助将不胜感激。

谢谢!

【问题讨论】:

  • 您能分享一下您终端上jps 的输出吗?
  • 您的 Spark 版本是多少?从 1.6.0 开始,Spark 包含 SparkR,您不应下载并安装较旧的 SparkR 版本 (1.4.0),因为您似乎已经这样做了(它将无法工作)。另外,检查是否设置了SPARK_HOME,以及您的SPARK_HOME/R/lib 目录是否存在
  • 我刚尝试下载 1.6.0 但安装该部分时遇到问题。我意识到我最初并没有这样做,所以一旦我弄清楚了,这个问题可能更相关。
  • 您在安装什么时遇到问题?火花1.6?如果是这样,请在此处查看我的答案stackoverflow.com/questions/33887227/…
  • 刚刚编辑了问题@desertnaut

标签: r apache-spark sparkr


【解决方案1】:

试试这个

Sys.setenv(SPARK_HOME = "C://Apache/spark-2.0.0")

您需要在上面使用“//”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-12
    • 1970-01-01
    • 2015-10-21
    • 2018-12-01
    • 2015-09-16
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    相关资源
    最近更新 更多