You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Martin Junghanns (JIRA)" <ji...@apache.org> on 2015/12/04 17:47:11 UTC

[jira] [Comment Edited] (FLINK-3118) Check if MessageFunction implements ResultTypeQueryable

    [ https://issues.apache.org/jira/browse/FLINK-3118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15041745#comment-15041745 ] 

Martin Junghanns edited comment on FLINK-3118 at 12/4/15 4:46 PM:
------------------------------------------------------------------

I am not so familiar with the type extraction mechanisms, yet. My suggestion would be sth like in {{TypeExtractor}}

{code}
@SuppressWarnings("unchecked")
public static <IN1, IN2, OUT> TypeInformation<OUT> createTypeInfo(Class<?> baseClass, Class<?> clazz, int returnParamPos, TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type, Object instance) {
    if (instance != null && instance instanceof ResultTypeQueryable) {
        return ((ResultTypeQueryable<OUT>) instance).getProducedType();
    } else {
        return createTypeInfo(baseClass, clazz, returnParamPos, in1Type, in2Type);
    }
}
{code}

which would be called (e.g. from {{VertexCentricIteration}}) like so

{code}
private TypeInformation<Message> getMessageType(MessagingFunction<K, VV, Message, EV> mf) {
    return TypeExtractor.createTypeInfo(MessagingFunction.class, mf.getClass(), 2, null, null, mf);
}
{code}


was (Author: mju):
I am not so familiar with the type extraction mechanisms, yet. My suggestion would be sth like

{code}
@SuppressWarnings("unchecked")
public static <IN1, IN2, OUT> TypeInformation<OUT> createTypeInfo(Class<?> baseClass, Class<?> clazz, int returnParamPos, TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type, Object instance) {
    if (instance != null && instance instanceof ResultTypeQueryable) {
        return ((ResultTypeQueryable<OUT>) instance).getProducedType();
    } else {
        return createTypeInfo(baseClass, clazz, returnParamPos, in1Type, in2Type);
    }
}
{code}

which would be called (e.g. from {{VertexCentricIteration}}) like so

{code}
private TypeInformation<Message> getMessageType(MessagingFunction<K, VV, Message, EV> mf) {
    return TypeExtractor.createTypeInfo(MessagingFunction.class, mf.getClass(), 2, null, null, mf);
}
{code}

> Check if MessageFunction implements ResultTypeQueryable
> -------------------------------------------------------
>
>                 Key: FLINK-3118
>                 URL: https://issues.apache.org/jira/browse/FLINK-3118
>             Project: Flink
>          Issue Type: Bug
>          Components: Gelly
>            Reporter: Martin Junghanns
>            Assignee: Martin Junghanns
>
> To generalize message values in vertex centric computations, it is necessary to let the user define the {{TypeInformation}} via {{ResultTypeQueryable}}. This needs to be checked in {{VertexCentricIteration}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)