You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/10 13:48:58 UTC

[jira] [Commented] (FLINK-4673) TypeInfoFactory for Either type

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

ASF GitHub Bot commented on FLINK-4673:
---------------------------------------

Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2545#discussion_r95365908
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java ---
    @@ -675,38 +673,6 @@ else if (isClassType(t) && Tuple.class.isAssignableFrom(typeToClass(t))) {
     			return new TupleTypeInfo(typeToClass(t), subTypesInfo);
     			
     		}
    -		// check if type is a subclass of Either
    -		else if (isClassType(t) && Either.class.isAssignableFrom(typeToClass(t))) {
    -			Type curT = t;
    -
    -			// go up the hierarchy until we reach Either (with or without generics)
    -			// collect the types while moving up for a later top-down
    -			while (!(isClassType(curT) && typeToClass(curT).equals(Either.class))) {
    -				typeHierarchy.add(curT);
    -				curT = typeToClass(curT).getGenericSuperclass();
    -			}
    -
    -			// check if Either has generics
    -			if (curT instanceof Class<?>) {
    -				throw new InvalidTypesException("Either needs to be parameterized by using generics.");
    -			}
    -
    -			typeHierarchy.add(curT);
    -
    -			// create the type information for the subtypes
    -			final TypeInformation<?>[] subTypesInfo = createSubTypesInfo(t, (ParameterizedType) curT, typeHierarchy, in1Type, in2Type, false);
    -			// type needs to be treated a pojo due to additional fields
    -			if (subTypesInfo == null) {
    -				if (t instanceof ParameterizedType) {
    -					return (TypeInformation<OUT>) analyzePojo(typeToClass(t), new ArrayList<Type>(typeHierarchy), (ParameterizedType) t, in1Type, in2Type);
    --- End diff --
    
    Sorry for not writing back earlier. You are right, all tests still work. The factories work better than I expected. We lose the input validation in this PR but I think this is ok. I will merge this.


> TypeInfoFactory for Either type
> -------------------------------
>
>                 Key: FLINK-4673
>                 URL: https://issues.apache.org/jira/browse/FLINK-4673
>             Project: Flink
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.0
>            Reporter: Greg Hogan
>            Assignee: Greg Hogan
>            Priority: Minor
>
> I was able to resolve the requirement to specify an explicit {{TypeInformation}} in the pull request for FLINK-4624 by creating a {{TypeInfoFactory}} for the {{Either}} type.



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