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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---