Re: Error while reading binary file

2016-02-08 Thread Till Rohrmann
Hi Saliya, in order to set the file path for the SerializedInputFormat you first have to create it and then explicitly call setFilePath. final SerializedInputFormat inputFormat = new SerializedInputFormat(); inputFormat.setFilePath(PATH_TO_FILE); env.createInput(inputFormat, myTypeInfo);

Re: Error while reading binary file

2016-02-08 Thread Maximilian Michels
Hi Saliya, Thanks for your question. Flink's type analyzer couldn't extract the type information. You may implement the ResultTypeQueryable interface in your custom source. That way you can manually specify the correct type. If that doesn't help you, could you please share more of the stack

Re: Error while reading binary file

2016-02-08 Thread Saliya Ekanayake
Thank you Till and Max. I'll try the set file path method and let you know. On Feb 8, 2016 5:45 AM, "Maximilian Michels" wrote: > Hi Saliya, > > Thanks for your question. Flink's type analyzer couldn't extract the > type information. You may implement the ResultTypeQueryable

Re: Error while reading binary file

2016-02-08 Thread Fabian Hueske
Hi, please try to replace DataSet ds = env.createInput(sif); by DataSet ds = env.createInput(sif, ValueTypeInfo.SHORT_VALUE_TYPE_INFO); Best, Fabian 2016-02-08 19:33 GMT+01:00 Saliya Ekanayake : > Till, > > I am still having trouble getting this to work. Here's my code ( >

Re: Error while reading binary file

2016-02-08 Thread Saliya Ekanayake
Thank you, Fabian. It solved the compilation error, but at runtime I get an end-of-file exception. I've put up a sample code with data at Github https://github.com/esaliya/flinkit. The data file is a binary file containing 64 Short values. 02/08/2016 16:01:19 CHAIN DataSource (at

Re: Error while reading binary file

2016-02-08 Thread Fabian Hueske
The SerializedInputFormat extends the BinaryInputFormat which expects a special block-wise encoding and certain metadata fields. It is not suited to read arbitrary binary files such as a file with 64 short values. I suggest to implement a custom input format based on FileInputFormat. Best, Fabian

Re: Error while reading binary file

2016-02-08 Thread Saliya Ekanayake
Till, I am still having trouble getting this to work. Here's my code ( https://github.com/esaliya/flinkit) String binaryFile = "src/main/resources/sample.bin"; SerializedInputFormat sif = new SerializedInputFormat<>(); sif.setFilePath(binaryFile); DataSet ds = env.createInput(sif);

Re: Error while reading binary file

2016-02-08 Thread Saliya Ekanayake
Thank you, Fabian. I'll try to do it. On Mon, Feb 8, 2016 at 4:37 PM, Fabian Hueske wrote: > The SerializedInputFormat extends the BinaryInputFormat which expects a > special block-wise encoding and certain metadata fields. > It is not suited to read arbitrary binary files

Error while reading binary file

2016-02-07 Thread Saliya Ekanayake
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.