我刚刚升级到使用spark 3而不是spark 2.4。
以下代码在spark 2.4中运行良好
df = spark.read.parquet('s3a://bucket/path/{'+
'file1,'+
'file2,'+
'file3,'+
'file4,'+
'file5,'+
'file6,'+
'file7,'+
'file8,'+
'file9,'+
'file10,'+
'file11,'+
'file12,'+
'file13,'+
'file14,'+
'file15,'+
'file16,'+
'file17,'+
'file18,'+
'file19,'+
'file20,'+
'file21,'+
'file22,'+
'file23,'+
'file24,'+
'file25'+
'}')
但在spark 3中,我得到了这个错误:
Py4JJavaError: An error occurred while calling o944.parquet.
: org.apache.hadoop.fs.s3a.AWSS3IOException: getFileStatus on s3a://
...
com.amazonaws.services.s3.model.AmazonS3Exception: Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: aaa), S3 Extended Request ID:
如果我将文件数量减少到小于24个,那么查询将在spark 3中成功完成。
在s3中,我找不到任何关于像这样的括号扩展中的文件数量限制的参考。可能出了什么问题?如何修复呢?
发布于 2021-01-19 15:31:36
为什么不让spark处理整个目录,让它扫描文件呢?
df = spark.read.parquet('s3a://bucket/path/')
发布于 2021-01-21 01:49:09
aws查询不能超过1024个字符。不知何故,这在spark 2中不是问题。
https://stackoverflow.com/questions/65744364
复制