[
https://issues.apache.org/jira/browse/FLINK-2569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14710986#comment-14710986
]
ASF GitHub Bot commented on FLINK-2569:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1053#discussion_r37847832
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java
---
@@ -174,13 +177,15 @@ public String toString() {
TypeInformation<?> info =
BasicTypeInfo.getInfoFor(type);
if (info == null) {
- throw new IllegalArgumentException("Type at
position " + i + " is not a basic type.");
+ try {
+ info =
ValueTypeInfo.getValueTypeInfo((Class<Value>) type);
--- End diff --
Any class can implement the `Value` interface.
We need to check if the class is on of the "BasicValue" classes, that
Flink ships.
> CsvReader support for ValueTypes
> --------------------------------
>
> Key: FLINK-2569
> URL: https://issues.apache.org/jira/browse/FLINK-2569
> Project: Flink
> Issue Type: Improvement
> Components: Java API
> Affects Versions: 0.9
> Reporter: Greg Hogan
> Assignee: Chiwan Park
> Priority: Minor
>
> From the Flink Programming Guide section on Data Sources:
> {quote}
> readCsvFile(path) / CsvInputFormat - Parses files of comma (or another char)
> delimited fields. Returns a DataSet of tuples or POJOs. Supports the basic
> java types and their Value counterparts as field types.
> {quote}
> When specifying a ValueType, i.e.
> {code}
> CsvReader csvReader = env.readCsvFile(filename);
> csvReader.types(IntValue.class, IntValue.class);
> {code}
> the following error occurs as BasicTypeInfo is specifically requested in
> CsvReader.types(...).
> {code}
> org.apache.flink.client.program.ProgramInvocationException: The main method
> caused an error.
> at
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:452)
> at
> org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:353)
> at org.apache.flink.client.program.Client.run(Client.java:327)
> at
> org.apache.flink.client.CliFrontend.executeProgram(CliFrontend.java:608)
> at org.apache.flink.client.CliFrontend.run(CliFrontend.java:296)
> at
> org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:927)
> at org.apache.flink.client.CliFrontend.main(CliFrontend.java:977)
> Caused by: java.lang.IllegalArgumentException: Type at position 0 is not a
> basic type.
> at
> org.apache.flink.api.java.typeutils.TupleTypeInfo.getBasicTupleTypeInfo(TupleTypeInfo.java:177)
> at org.apache.flink.api.java.io.CsvReader.types(CsvReader.java:393)
> at Driver.main(Driver.java:105)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:497)
> at
> org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:437)
> ... 6 more
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)