0
试图读取从Java火花上下文中的S3数据:阅读文件与子目录沿着从S3使用sc.textFile
"mapreduce.input.fileinputformat.input.dir.recursive", "true"
jsc.textFile(filePath);
它是为我工作时,我只有内部的文件夹小时:
s3://<year>/<month>/<day>/<hour>/<files>
jsc.textFile("s3://<year>/<month>/<day>");
现在,在平行小时的文件夹S3我们可能有new_folder以及
s3://<year>/<month>/<day>/<hour>/<files>
s3://<year>/<month>/<day>/<hour>/<new_folder>/<files>
下面的代码忽略文件下new_folder小号
jsc.textFile("s3://<year>/<month>/<day>");
试图用多个正则表达式,但我的方法 “isPathExist” 总是使用以下方法返回false
jsc.textFile("s3n://<year>/<month>/<day>/*/<regular_expression>");
经过S3路径,其中返回false
private static boolean isPathExists(String folderPath, String bucket, String accessKey, String secret) {
AWSCredentials cred = new BasicAWSCredentials(accessKey, secret);
AmazonS3 s3 = new AmazonS3Client(cred);
ObjectListing objectListing = s3
.listObjects(new ListObjectsRequest().withBucketName(bucket).withPrefix(folderPath));
return !objectListing.getObjectSummaries().isEmpty();
}
什么是你所得到的输出?你有什么异常?请提供更多详细信息 – RBanerjee
*尝试使用多个正则表达式* ...该方法不接受正则表达式,而且这些方法甚至不包含正则表达式 –