使用来自 s3 或本地文件系统的 spark 从子目录递归读取文件 [英] read files recursively from sub directories with spark from s3 or local filesystem

查看:34
本文介绍了使用来自 s3 或本地文件系统的 spark 从子目录递归读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从包含许多子目录的目录中读取文件.数据在 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.mapreduce.lib.input.TextInputFormat],
    classOf[org.apache.hadoop.mapreduce.lib.input.TextInputFormat],
    classOf[org.apache.hadoop.io.NullWritable])

这似乎不起作用.

感谢帮助

推荐答案

是的,它的工作原理,虽然花了一些时间来获取单个块/拆分,基本上每个子目录中的特定目录:s3n://bucket/root_dir/*/data/*/*/*

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 或本地文件系统的 spark 从子目录递归读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆