[
https://issues.apache.org/jira/browse/FLINK-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14376952#comment-14376952
]
ASF GitHub Bot commented on FLINK-1512:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/426#discussion_r26993339
--- Diff:
flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvInputFormat.java
---
@@ -219,73 +92,24 @@ public OUT readRecord(OUT reuse, byte[] bytes, int
offset, int numBytes) {
}
if (parseRecord(parsedValues, bytes, offset, numBytes)) {
- OUT result = serializer.createInstance(parsedValues);
- return result;
+ if (tupleSerializer != null) {
+ return
tupleSerializer.createInstance(parsedValues);
+ } else {
+ try {
+ for (int i = 0; i < pojoFields.length;
i++) {
+ pojoFields[i].set(reuse,
parsedValues[i]);
+ }
+ } catch (IllegalAccessException e) {
+ LOG.error("Cannot set value to given
type object!", e);
--- End diff --
same as in the `CsvInputFormat`. Forward the exception to kill the job.
> Add CsvReader for reading into POJOs.
> -------------------------------------
>
> Key: FLINK-1512
> URL: https://issues.apache.org/jira/browse/FLINK-1512
> Project: Flink
> Issue Type: New Feature
> Components: Java API, Scala API
> Reporter: Robert Metzger
> Assignee: Chiwan Park
> Priority: Minor
> Labels: starter
>
> Currently, the {{CsvReader}} supports only TupleXX types.
> It would be nice if users were also able to read into POJOs.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)