2

After correctly setting up my project I need to read/import several .bsq files into my environment. I tried to use the env.readFile() method like this:

DataSet<T> data = env.readFile(*insertFileInputFormatHere*, filePath);

But I am not able to get a proper FileInputFormat. Since it is abstract I can't have my own instance. Should I extend the abstract class FileInputFormat and use my own extension to instantiate a FileInputFormat? Or is there another way I did not recognize?

4

1 回答 1

6

似乎.bsq文件是不存在 Flink 或 Hadoop InputFormat 的二进制格式(我包括 Hadoop InputFormats,因为 Flink 也支持 Hadoop IF)

所以你必须实现你自己的InputFormat来读取文件。我建议从 Flink 扩展您自己的 InputFormat org.apache.flink.api.common.io.FileInputFormat

要使用您自己的输入格式,您必须像这样称呼它

final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.createInput(new MyInputFormat());
于 2015-09-16T14:57:39.027 回答