[
https://issues.apache.org/jira/browse/FLINK-1227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14204818#comment-14204818
]
Chesnay Schepler commented on FLINK-1227:
-----------------------------------------
oh you are right...i see, i missed the actual problem.
ok so this is fails with the current code:
{code:java}
public static class MySel implements KeySelector, ResultTypeQueryable {
public TypeIiformation getProducedType() {
return getForObject(new Integer(0));
}
public Object getKey(Object value) throws Exception {
return 0;
}
{code}
this gives this error:
Exception in thread "main" java.lang.IllegalArgumentException: The types of the
interface org.apache.flink.api.java.functions.KeySelector could not be
inferred. Support for synthetic interfaces, lambdas, and generic types is
limited at this point.
at
org.apache.flink.api.java.typeutils.TypeExtractor.getParameterType(TypeExtractor.java:509)
at
org.apache.flink.api.java.typeutils.TypeExtractor.getParameterTypeFromGenericType(TypeExtractor.java:533)
at
org.apache.flink.api.java.typeutils.TypeExtractor.getParameterType(TypeExtractor.java:496)
at
org.apache.flink.api.java.typeutils.TypeExtractor.validateInputType(TypeExtractor.java:555)
at
org.apache.flink.api.java.typeutils.TypeExtractor.getUnaryOperatorReturnType(TypeExtractor.java:143)
at
org.apache.flink.api.java.typeutils.TypeExtractor.getKeySelectorTypes(TypeExtractor.java:115)
so the reason why it worked with the change is because i skip the
validateInputType stuff.
> KeySelector can't implement ResultTypeQueryable
> -----------------------------------------------
>
> Key: FLINK-1227
> URL: https://issues.apache.org/jira/browse/FLINK-1227
> Project: Flink
> Issue Type: Improvement
> Components: Java API
> Affects Versions: 0.7.0-incubating
> Reporter: Chesnay Schepler
> Assignee: Chesnay Schepler
> Priority: Trivial
>
> The TypeExtractor currently doesn't check whether a KeySelector implements
> the ResultTypeQueryable interface.
> Since i expected it to work i guess you can call ti a clarity issue.
> Additionally, this change will allow me to use KeySelector for the Python API.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)