gpt4 book ai didi

r - Sparklyr:sdf_copy_to失败,包含350 MB数据集

转载 作者:行者123 更新时间:2023-12-02 20:56:48 25 4
gpt4 key购买 nike

我在尝试使用sparklyr::spark_write_csv()编写2个数据集时遇到问题。这是我的配置:

# Configure cluster
config <- spark_config()
config$spark.yarn.keytab <- "mykeytab.keytab"
config$spark.yarn.principal <- "myyarnprincipal"
config$sparklyr.gateway.start.timeout <- 10
config$spark.executor.instances <- 2
config$spark.executor.cores <- 4
config$spark.executor.memory <- "4G"
config$spark.driver.memory <- "4G"

config$spark.kryoserializer.buffer.max <- "1G"

Sys.setenv(SPARK_HOME = "/opt/cloudera/parcels/CDH/lib/spark")
Sys.setenv(HADOOP_CONF_DIR = '/etc/hadoop/conf.cloudera.hdfs')
Sys.setenv(YARN_CONF_DIR = '/etc/hadoop/conf.cloudera.yarn')

# Configure cluster
sc <- spark_connect(master = "yarn-client", config = config, version = '1.6.0')

成功创建spark上下文后,我试图使用spark_write_csv()将2个数据集保存在hdfs上。作为中间步骤,我需要将数据帧转换为tbl_spark。
不幸的是,我只能正确地保存第一个,而第二个(较长,但对于Hadoop标准,即360 MB绝对不大)需要很长时间,最终会崩溃。
# load datasets
tmp_small <- read.csv("first_one.csv", sep = "|") # 13 MB
tmp_big <- read.csv("second_one.csv", sep = "|") # 352 MB

tmp_small_Spark <- sdf_copy_to(sc, tmp_small, "tmp_small", memory = F, overwrite = T)
tables_preview <- dbGetQuery(sc, "SHOW TABLES")

tmp_big_Spark <- sdf_copy_to(sc, tmp_big, "tmp_big", memory = F, overwrite = T) # fail!!
tables_preview <- dbGetQuery(sc, "SHOW TABLES")

这可能是配置问题,但我无法弄清楚。
这是错误: |================================================================================| 100% 352 MB
Error in invoke_method.spark_shell_connection(sc, TRUE, class, method,  : 
No status is returned. Spark R backend might have failed.

谢谢

最佳答案

我在加载较大的文件时也遇到了问题。尝试将其添加到spark连接配置文件中:

config$spark.rpc.message.maxSize <- 512

不过,这是一种解决方法。

关于r - Sparklyr:sdf_copy_to失败,包含350 MB数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44278085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com