[
https://issues.apache.org/jira/browse/FLINK-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14802966#comment-14802966
]
ASF GitHub Bot commented on FLINK-2690:
---------------------------------------
GitHub user tillrohrmann opened a pull request:
https://github.com/apache/flink/pull/1141
[FLINK-2690] [api-breaking] [scala api] [java api] Allows CsvInputFormat to
use derived Pojos
This PR adds support for the `CsvInputFormat` to use derived Pojos. In
order to also find pojo fields defined in a parent class, one has to traverse
the type hierarchy. This is done by the function `findAllFields`.
While working on the `CsvInputFormat`, I noticed that the
`ScalaCsvInputFormat` shared almost all code with the `CsvInputFormat`. In
order to reduce duplicated code, both input formats now extend the
`CommonCsvInputFormat` which contains the shared code.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tillrohrmann/flink fixCsvInputFormatPojo
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/1141.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1141
----
commit bf2e2c40f340ccfe31256744380345287c9e6f9e
Author: Till Rohrmann <[email protected]>
Date: 2015-09-17T13:28:25Z
[FLINK-2690] [api-breaking] [scala api] [java api] Adds functionality to
the CsvInputFormat to find fields defined in a super class of a Pojo. Refactors
CsvInputFormat to share code between this format and ScalaCsvInputFormat.
----
> CsvInputFormat cannot find the field of derived POJO class
> ----------------------------------------------------------
>
> Key: FLINK-2690
> URL: https://issues.apache.org/jira/browse/FLINK-2690
> Project: Flink
> Issue Type: Bug
> Components: Java API, Scala API
> Affects Versions: 0.10
> Reporter: Chiwan Park
> Assignee: Till Rohrmann
>
> A user reports {{CsvInputFormat}} cannot find the field of derived POJO
> class.
> (http://mail-archives.apache.org/mod_mbox/flink-user/201509.mbox/%3ccaj54yvi6cbldn7cypey+xe8a5a_j1-6tnx1wm1eb63gvnqd...@mail.gmail.com%3e)
> The reason of the bug is that {{CsvInputFormat}} uses {{getDeclaredField}}
> method without scanning base classes to find the field. When
> {{CsvInputFormat}} was wrote, {{TypeInformation}} cannot be serialized. So we
> needed to initialize {{TypeInformation}} in {{open}} method manually. Some
> mistakes in initializing cause this bug.
> After FLINK-2637 is merged, we can serialize {{TypeInformation}} and don't
> need to create field objects in {{CsvInputFormat}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)