Hi, Can someone please point me to an example of creating DataSet using Avro Generic Records?I tried this code - final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();But I got an exception- Caused by: org.apache.avro.AvroRuntimeException: Not a Specific class: interface org.apache.avro.generic.GenericRecord at org.apache.avro.specific.SpecificData.createSchema(SpecificData.java:276) at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:594) at org.apache.avro.specific.SpecificData.getSchema(SpecificData.java:217) at org.apache.avro.reflect.ReflectDatumReader.<init>(ReflectDatumReader.java:50) at org.apache.flink.api.java.io.AvroInputFormat.open(AvroInputFormat.java:100) at org.apache.flink.api.java.io.AvroInputFormat.open(AvroInputFormat.java:41) at org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:147) at org.apache.flink.runtime.taskmanager.Task.run(Task.java:559) at java.lang.Thread.run(Thread.java:745) By looking at StackTrace, I get that AvroInputFormat tries to read Avro file as SpecificRecords. Is there a way to read Avro file as GenericRecords? Tarandeep |
There is a way yet, but I am proposing to do one: https://issues.apache.org/jira/browse/FLINK-3691 On Fri, Apr 1, 2016 at 4:04 AM, Tarandeep Singh <[hidden email]> wrote:
|
In reply to this post by Tarandeep Singh
Tarandeep, There isn't a way yet, but I am proposing to do one: https://issues.apache.org/jira/browse/FLINK-3691 -Gna On Fri, Apr 1, 2016 at 4:04 AM, Tarandeep Singh <[hidden email]> wrote:
|
Thank you Gna for opening the ticket. I looked into AvroInputFormat code and inspired by it I wrote a GenericAvroInputFormat. The code is awfully similar (and hence redundant) to original AvroInputFormat, so it is a good idea to modify AvroInputFormat in flink to support GenericRecord. Anyways, I am pasting the code here for anyone who wants to use it (till your code is part of Flink stable release)- import java.io.IOException; public static void main(String[] args) throws Exception { On Fri, Apr 1, 2016 at 3:40 PM, Sourigna Phetsarath <[hidden email]> wrote:
|
Tranadeep, Thanks for pasting your code! Still waiting for the legal team at AOL to approve it. -Gna On Sat, Apr 2, 2016 at 5:36 PM, Tarandeep Singh <[hidden email]> wrote:
|
Tranadeep, Also, in your code example, when reuseAvroValue is false the code will fail with this message:
I had encountered this when I was write the PR. -Gna On Thu, Apr 7, 2016 at 11:08 AM, Sourigna Phetsarath <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |