我在hadoop hdfs上存储了.csv文件,
hadoop dfs -ls /afs
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
17/01/12 15:15:49 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 item
-rw-r--r-- 2 hduser supergroup 203572404 2017-01-10 12:04 /afs/Accounts.csv
我想用sparkr把这个文件导入rstudio。
我尝试了以下命令:
sc<-sparkR.session(master = "spark://MasterNode:7077",appName = "SparkR",sparkHome = "/opt/spark")
sContext<- sparkRSQL.init(sc)
library(data.table)
library(dplyr)
df<- read.df(sContext, "hdfs://MasterNode:54310/afs/Accounts.csv")
出现以下错误:
> df<- read.df(sContext, "hdfs://MasterNode:54310/afs/Accounts.csv")
Error in handleErrors(returnStatus, conn) :
No status is returned. Java SparkR backend might have failed.
In addition: Warning message:
In writeBin(requestMessage, conn) : problem writing to connection
请帮助我导入accounts.csv文件到rstudio使用sparkr。
1条答案
按热度按时间uinbv5nw1#
你可以用
fread
系统的功能data.table
从hdfs读取的库。您必须指定hdfs
系统中的可执行文件。例如,假设hdfs的路径是/usr/bin/hdfs
,您可以尝试以下操作:如果“accounts.csv”是一个目录,那么也可以使用通配符
/afs/Accounts.csv/*
还可以指定列类。例如:我希望这有帮助。