[ https://issues.apache.org/jira/browse/FLINK-4673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15522592#comment-15522592 ]
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_r80424649 --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/EitherTypeInfoFactory.java --- @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.api.java.typeutils; + +import org.apache.flink.api.common.typeinfo.TypeInfoFactory; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.types.Either; + +import java.lang.reflect.Type; +import java.util.Map; + +public class EitherTypeInfoFactory<L, R> extends TypeInfoFactory<Either<L, R>> { + + @Override + public TypeInformation<Either<L, R>> createTypeInfo(Type t, Map<String, TypeInformation<?>> genericParameters) { + return new EitherTypeInfo(genericParameters.get("L"), genericParameters.get("R")); --- End diff -- Can check here if the key is not null? Btw. we should add a null check to the constructor of EitherTypeInfo. > 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)