从S3或本地文件系统火花子目录递归地读取文件 [英] read files recursively from sub directories with spark from s3 or local filesystem
本文介绍了从S3或本地文件系统火花子目录递归地读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从其中包含许多子目录的目录中读取文件。数据处于S3,我试图做到这一点:
I am trying to read files from a directory which contains many sub directories. The data is in S3 and I am trying to do this:
VAL RDD = sc.newAPIHadoopFile(data_loc,
classOf [org.apache.hadoop.ma preduce.lib.input.TextInputFormat]
classOf [org.apache.hadoop.ma preduce.lib.input.TextInputFormat]
classOf [org.apache.hadoop.io.NullWritable])
这似乎并没有工作。
鸭preciate帮助
Appreciate the help
推荐答案
是的,它的工作原理,花了一段时间来获取单个块/虽然分裂,基本上在每一个子目录一个特定的目录: S3N://桶/ ROOT_DIR / * /数据/ * / * / *
yes it works, took a while to get the individual blocks/splits though , basically a specific directory in every sub directory :
s3n://bucket/root_dir/*/data/*/*/*
这篇关于从S3或本地文件系统火花子目录递归地读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文