【发布时间】:2017-12-18 16:42:55
【问题描述】:
我们正在尝试使用 sparklyr 中的 spark_read_csv 函数加载存储在 HDFS 中的 csv 文件。 R代码运行在windows桌面上,配置为以yarn-client模式连接远程yarn集群,提交和执行作业。使用的 spark 版本是 1.6.0 。 我们已将 com.databricks_spark-csv_2.10-1.0.3.jar 和 org.apache.commons_commons-csv-1.1.jar 包含到 spark 类路径中,因为 spark 1.6.0 不支持 CSV。 问题:当我们调用
spark_read_csv(sc=sc
,path ="/user/xyz/adv.csv"
,name ="FinStatement"
,infer_schema = TRUE
,header = TRUE
)
系统在路径名前面加上驱动器号“C”后,在远程 hdfs 中查找文件。代码搜索到的hdfs位置是hdfs://machine-name/C:/user/user1/adv.csv而不是查看hdfs://machine-name/user/user1/adv.csv,因此检索失败文件。 非常感谢您对解决问题的任何帮助。
Spark 版本:1.6.0 Sparklyr 版本:0.5.6 Hadoop版本:2.6.0 异常跟踪:
Error: java.lang.IllegalArgumentException: Pathname /C:/user/user1/adv.csv from hdfs://machine-name/C:/user/p587722/adv.csv is not a valid DFS filename.
at org.apache.hadoop.hdfs.DistributedFileSystem.getPathName(DistributedFileSystem.java:196)
at org.apache.hadoop.hdfs.DistributedFileSystem.access$000(DistributedFileSystem.java:105)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1118)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1114)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
at org.apache.hadoop.fs.Globber.getFileStatus(Globber.java:57)
Rstudio 会话信息:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.2.0 rJava_0.9-8 dplyr_0.7.1 sparklyr_0.5.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 rstudioapi_0.6 bindr_0.1 magrittr_1.5 xtable_1.8-2 R6_2.2.0 rlang_0.1.1
[8] httr_1.2.1 tools_3.3.2 DBI_0.7 withr_1.0.2 dbplyr_1.1.0 htmltools_0.3.6 assertthat_0.2.0
[15] rprojroot_1.2 digest_0.6.12 tibble_1.3.3 bindrcpp_0.2 shiny_1.0.3 base64enc_0.1-3 glue_1.1.1
[22] mime_0.5 stringi_1.1.3 backports_1.0.5 jsonlite_1.5 httpuv_1.3.3 pkgconfig_2.0.1
【问题讨论】: