无法使用Spark(sparklyr)独立模式编写镶木地板无法重命名DeprecatedRawLocalFileStatus

时间:2017-10-31 03:39:04

标签: apache-spark sparklyr

我在独立模式下使用spark并使用sparklyr访问spark。我正在尝试使用以下代码写入镶木地板文件:

temp_parquet <- tempfile(fileext = ".parquet")

temp_parquet1 <- tempfile(fileext = ".parquet")

spark_write_parquet(train, temp_parquet)

但是我经常遇到以下错误:

 at java.lang.Thread.run(Thread.java:748)
 Caused by: java.io.IOException: Failed to rename DeprecatedRawLocalFileStatus
 {path=file:/tmp/RtmpZbeJyA/file167e088fa054.parquet/_temporary/0/
 task_20171031030835_0010_m_000021/part-00021-9a9b102c-224e-445d-b704-
 7bddc915b2e7-c000.snappy.parquet; isDirectory=false; length=8468208; 
 replication=1; blocksize=33554432; modification_time=1509419381000; 
 access_time=0; owner=; group=; permission=rw-rw-rw-; isSymlink=false}

我使用的是具有128个内核和2TB内存的Ubuntu VM。我更改了目录的权限,这似乎没有任何区别。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我找到了一种解决方法,创建了一个hdfs集群,并将文件作为镶木板写入hdfs。这是我在HDFS启动并运行后使用的代码:

#Create unique paths to temp
temp_parquet <- tempfile(fileext = ".parquet")
temp_parquet1 <- tempfile(fileext = ".parquet")

#add hdfs to temp path
test_path<-paste0("hdfs://localhost:9000", temp_parquet)
train_path<-paste0("hdfs://localhost:9000", temp_parquet1)

#write parquet files
spark_write_parquet(spark_train_df, test_path, mode = "overwrite")
spark_write_parquet(spark_test_df, train_path, mode = "overwrite")
相关问题