[ 
https://issues.apache.org/jira/browse/FLINK-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14353460#comment-14353460
 ] 

Robert Metzger commented on FLINK-1388:
---------------------------------------

Thank you for updating your changes.

There is the following problem with the change: You've added another {{public 
void writeRecord(T element, Object pojo) throws IOException}} method with a 
different signature. Inside the method, you're casting {{T element}} to 
TypeInformation. But at runtime the system will not pass TypeInformations in 
there, it will pass the actual POJO objects.
So this cast will fail.

You have to pass the TypeInformation into the CsvOutputFormat when creating it 
in the {{DataSet}}. The TypeInformation is the same for all records.

> POJO support for writeAsCsv
> ---------------------------
>
>                 Key: FLINK-1388
>                 URL: https://issues.apache.org/jira/browse/FLINK-1388
>             Project: Flink
>          Issue Type: New Feature
>          Components: Java API
>            Reporter: Timo Walther
>            Assignee: Adnan Khan
>            Priority: Minor
>
> It would be great if one could simply write out POJOs in CSV format.
> {code}
> public class MyPojo {
>    String a;
>    int b;
> }
> {code}
> to:
> {code}
> # CSV file of org.apache.flink.MyPojo: String a, int b
> "Hello World", 42
> "Hello World 2", 47
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to