String binaryFile = "src/main/resources/sample.bin";
SerializedInputFormat<ShortValue> sif = new SerializedInputFormat<>();
sif.setFilePath(binaryFile);
DataSet<ShortValue> ds = env.createInput(sif);
System.out.println(ds.count());
Hi Saliya,
in order to set the file path for the
SerializedInputFormat
you first have to create it and then explicitly callsetFilePath
.final SerializedInputFormat<Record> inputFormat = new SerializedInputFormat<Record>(); inputFormat.setFilePath(PATH_TO_FILE); env.createInput(inputFormat, myTypeInfo);
Cheers,
TillOn Mon, Feb 8, 2016 at 7:00 AM, Saliya Ekanayake <[hidden email]> wrote:Hi,I was trying to read a simple binary file using SerializedInputFormat as suggested in a different thread, but encounters the following error. I tried to do what the exception suggests, but eventhough createInput() returns a DataSet object I couldn't find how to specify which file to read.Any help is appreciated. The file I am trying to read is a simple binary file with containing java short values. Is there any example on reading binary files available?Exception in thread "main" org.apache.flink.api.common.InvalidProgramException: The type returned by the input format could not be automatically determined. Please specify the TypeInformation of the produced type explicitly by using the 'createInput(InputFormat, TypeInformation)' method instead.Thank you,Saliya--Saliya EkanayakePh.D. Candidate | Research AssistantSchool of Informatics and Computing | Digital Science CenterIndiana University, Bloomington
Cell <a href="tel:812-391-4914" value="+18123914914" target="_blank">812-391-4914
http://saliya.org
Free forum by Nabble | Edit this page |