You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 无痕 <95...@qq.com> on 2020/04/27 07:42:57 UTC
回复: flink 批方式如何读取多路径文件或通配符文件
感谢回复!
应用使用Dataset,查了下FileInputFormat是抽象类,我看里面supportsMultiPaths方法被Deprecated
/**
* Override this method to supports multiple paths.
* When this method will be removed, all FileInputFormats have to support multiple paths.
*
* @return True if the FileInputFormat supports multiple paths, false otherwise.
*
* @deprecated Will be removed for Flink 2.0.
*/
@Deprecated
public boolean supportsMultiPaths() {
return false;
}
------------------ 原始邮件 ------------------
发件人: "Jingsong Li"<jingsonglee0@gmail.com>;
发送时间: 2020年4月27日(星期一) 上午9:29
收件人: "user-zh"<user-zh@flink.apache.org>;
主题: Re: flink 批方式如何读取多路径文件或通配符文件
Hi,
你是在用Dataset还是SQL?
如果是Dataset或是Datastream
先把文件筛选出来,然后FileInputFormat.setFilePaths?
Best,
Jingsong Lee
On Sun, Apr 26, 2020 at 10:01 PM 无痕 <95509026@qq.com> wrote:
> HI ALL :
> &nbsp; &nbsp; &nbsp;请问下,flink批方式如何读取多路径文件或通配符文件?如下:
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/abc/202004*/t1.data&nbsp;
> 读2020年4月所有t1.data文件;
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/abc/20200401/t*.data
> 读2020年4月1日目录下所有t开头的文件
> &nbsp; &nbsp; &nbsp;谢谢!
--
Best, Jingsong Lee
Re: flink 批方式如何读取多路径文件或通配符文件
Posted by Jingsong Li <ji...@gmail.com>.
"all FileInputFormats have to support multiple paths"
如果你有自己的实现,overwrite supportsMultiPaths它为true,几乎所有的实现有是true的。
如果你使用DataStream,需注意了,不能使用StreamExecutionEnvironment.createInput(不支持多路径),需显示使用addSource(new
InputFormatSourceFunction)
Best,
Jingsong Lee
On Mon, Apr 27, 2020 at 3:43 PM 无痕 <95...@qq.com> wrote:
> 感谢回复!
> 应用使用Dataset,查了下FileInputFormat是抽象类,我看里面supportsMultiPaths方法被Deprecated
> /**
> * Override this method to supports multiple paths.
> * When this method will be removed, all FileInputFormats have to support
> multiple paths.
> *
> * @return True if the FileInputFormat supports multiple paths, false
> otherwise.
> *
> * @deprecated Will be removed for Flink 2.0.
> */
> @Deprecated
> public boolean supportsMultiPaths() {
> return false;
> }
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Jingsong Li"<jingsonglee0@gmail.com>;
> 发送时间: 2020年4月27日(星期一) 上午9:29
> 收件人: "user-zh"<user-zh@flink.apache.org>;
>
> 主题: Re: flink 批方式如何读取多路径文件或通配符文件
>
>
>
> Hi,
>
> 你是在用Dataset还是SQL?
>
> 如果是Dataset或是Datastream
> 先把文件筛选出来,然后FileInputFormat.setFilePaths?
>
> Best,
> Jingsong Lee
>
> On Sun, Apr 26, 2020 at 10:01 PM 无痕 <95509026@qq.com> wrote:
>
> > HI ALL :
> > &nbsp; &nbsp; &nbsp;请问下,flink批方式如何读取多路径文件或通配符文件?如下:
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
> &nbsp;/abc/202004*/t1.data&nbsp;
> > 读2020年4月所有t1.data文件;
> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
> &nbsp;/abc/20200401/t*.data
> > 读2020年4月1日目录下所有t开头的文件
> > &nbsp; &nbsp; &nbsp;谢谢!
>
>
>
> --
> Best, Jingsong Lee
--
Best, Jingsong Lee