Flink type extraction problems with custom generic class -
(flink 1.3)
i have problems type extraction:
the return type of function '...' not determined automatically, due type erasure. can give type information hints using returns(...) method on result of transformation call, or letting function implement 'resulttypequeryable' interface.
when using datastream<mygenericclass<t>>
where:
public class mygenericclass<t> extends tuple2<string, t> { ... }
how can solve problem without .returns(..)
solution?
can give me example on how implement type information factory or how implement resulttypequeryable
mygenericclass
?
thank in advance
disclaimer : answer based on assumption using java8 lambda expression
i not sure, according flink documentation - problem because "compilers such openjdk’s , oracle jdk’s javac throw away generic parameters related lambda expressions. means types such tuple2 or collector declared lambda function input or output parameter pruned tuple2 or collector in compiled .class files, little information flink compiler."
according same fink documentation - "only eclipse jdt compiler preserves generic type information necessary use entire lambda expressions feature type-safely."
so solve problem can manually add following information in pom.xml, such maven use eclipse jdt compiler -
<!-- put these lines under "project/build/pluginmanagement/plugins" of pom.xml --> <plugin> <!-- use compiler plugin tycho adapter jdt compiler. --> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.8</source> <target>1.8</target> <compilerid>jdt</compilerid> </configuration> <dependencies> <!-- dependency provides implementation of compiler "jdt": --> <dependency> <groupid>org.eclipse.tycho</groupid> <artifactid>tycho-compiler-jdt</artifactid> <version>0.21.0</version> </dependency> </dependencies> </plugin>
for more information refer link - https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/java8.html
Comments
Post a Comment