Pyspark AWS Glue-连接中面临内存问题并将其存储在S3中
我在S3中存储了大约200个压缩JSON行文件,每个文件的大小为500MB。每个JSON行都有empid、empname和array列,其中包含原始简历文本内容。每个文件包含2500行JSON。我正在创建一个动态框架Pyspark AWS Glue-连接中面临内存问题并将其存储在S3中,pyspark,aws-glue,aws-glue-spark,Pyspark,Aws Glue,Aws Glue Spark,我在S3中存储了大约200个压缩JSON行文件,每个文件的大小为500MB。每个JSON行都有empid、empname和array列,其中包含原始简历文本内容。每个文件包含2500行JSON。我正在创建一个动态框架 f1 = glueContext.create_dynamic_frame.from_options( connection_type = "s3", connection_options = { "paths"
f1 = glueContext.create_dynamic_frame.from_options(
connection_type = "s3",
connection_options = {
"paths": [ "<path>" ],
"recurse": True,
"groupFiles": "inPartition",
"groupSize": "1048576",
"compressionType":"gzip"
},
format="json"
)
f2 = glueContext.create_dynamic_frame.from_options(
connection_type = "s3",
connection_options = {
"paths": ["<filepath>"],
},
format="csv",
format_options={
'withHeader': True
}
)
最后存储匹配结果
glueContext.write_dynamic_frame.from_options(
frame = merged_frame,
connection_type = "s3",
connection_options = {
"path": '<path>',
"compression": "gzip"
},
format = "json",
)
glueContext.write\u dynamic\u frame.from\u选项(
帧=合并的帧,
连接类型=“s3”,
连接\u选项={
“路径”:“”,
“压缩”:“gzip”
},
format=“json”,
)
目标:需要根据查找文件从庞大的数据集中创建记录子集
我面临内存不足的问题,因此从标准工作类型改为G1工作类型,有6个工作类型,但仍然面临堆内存问题。我遗漏了什么吗?有人能帮我一下吗?当你说“记忆不足”时,你说的是哪种记忆?此外,您不需要使用groupFiles和groupSize选项,因为您的文件已经足够大了。您是否尝试过使用toDf将这些动态帧转换为数据帧并执行联接操作?@prabhakarredy
java.lang.OutOfMemoryError:java heap space Driver
这是我遇到的错误。您是否可以尝试此处提到的s3listimplementation和本文档中提到的其他方法?我已经尝试过,但仍然得到了正确的结果同样的错误。你能更新问题中的完整脚本吗?您是否也尝试过将动态帧转换为数据帧并尝试过将它们连接起来?
glueContext.write_dynamic_frame.from_options(
frame = merged_frame,
connection_type = "s3",
connection_options = {
"path": '<path>',
"compression": "gzip"
},
format = "json",
)