[
https://issues.apache.org/jira/browse/FLINK-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14356935#comment-14356935
]
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_r26216185
--- Diff:
flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvInputFormat.java
---
@@ -66,18 +66,30 @@
public ScalaCsvInputFormat(Path filePath, TypeInformation<OUT>
typeInfo) {
super(filePath);
- if (!(typeInfo.isTupleType())) {
- throw new UnsupportedOperationException("This only
works on tuple types.");
- }
- TupleTypeInfoBase<OUT> tupleType = (TupleTypeInfoBase<OUT>)
typeInfo;
- // We can use an empty config here, since we only use the
serializer to create
- // the top-level case class
- serializer = (TupleSerializerBase<OUT>)
tupleType.createSerializer(new ExecutionConfig());
-
- Class<?>[] classes = new Class[tupleType.getArity()];
- for (int i = 0; i < tupleType.getArity(); i++) {
- classes[i] = tupleType.getTypeAt(i).getTypeClass();
+ Class<?>[] classes = new Class[typeInfo.getArity()];
+
+ if (typeInfo instanceof TupleTypeInfoBase) {
--- End diff --
It would be nice to also support Scala case classes. Check out the
CaseClassTypeInfo for some details if you want to add support for that.
> 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)