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 2019/05/07 09:21:00 UTC

[jira] [Updated] (FLINK-12175) TypeExtractor.getMapReturnTypes produces different TypeInformation than createTypeInformation for classes with parameterized ancestors

     [ https://issues.apache.org/jira/browse/FLINK-12175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated FLINK-12175:
-----------------------------------
    Labels: pull-request-available  (was: )

> TypeExtractor.getMapReturnTypes produces different TypeInformation than createTypeInformation for classes with parameterized ancestors
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-12175
>                 URL: https://issues.apache.org/jira/browse/FLINK-12175
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Type Serialization System
>    Affects Versions: 1.7.2, 1.9.0
>            Reporter: Dylan Adams
>            Priority: Major
>              Labels: pull-request-available
>
> I expect that the {{TypeMapper}} {{createTypeInformation}} and {{getMapReturnTypes}} would produce equivalent type information for the same type. But when there is a parameterized superclass, this does not appear to be the case.
> Here's a test case that could be added to {{PojoTypeExtractorTest.java}} that demonstrates the issue:
> {code}
> public static class Pojo implements Serializable {
> 	public int digits;
> 	public String letters;
> }
> public static class ParameterizedParent<T extends Serializable> implements Serializable {
> 	public T pojoField;
> }
> public static class ConcreteImpl extends ParameterizedParent<Pojo> {
> 	public double precise;
> }
> public static class ConcreteMapFunction implements MapFunction<ConcreteImpl, ConcreteImpl> {
> 	@Override
> 	public ConcreteImpl map(ConcreteImpl value) throws Exception {
> 		return null;
> 	}
> }
> @Test
> public void testMapReturnType() {
> 	final TypeInformation<ConcreteImpl> directTypeInfo = TypeExtractor.createTypeInfo(ConcreteImpl.class);
> 	Assert.assertTrue(directTypeInfo instanceof PojoTypeInfo);
> 	TypeInformation<?> directPojoFieldTypeInfo = ((PojoTypeInfo) directTypeInfo).getPojoFieldAt(0).getTypeInformation();
> 	Assert.assertTrue(directPojoFieldTypeInfo instanceof PojoTypeInfo);
> 	final TypeInformation<ConcreteImpl> mapReturnTypeInfo
> 		= TypeExtractor.getMapReturnTypes(new ConcreteMapFunction(), directTypeInfo);
> 	Assert.assertTrue(mapReturnTypeInfo instanceof PojoTypeInfo);
> 	TypeInformation<?> mapReturnPojoFieldTypeInfo = ((PojoTypeInfo) mapReturnTypeInfo).getPojoFieldAt(0).getTypeInformation();
> 	Assert.assertTrue(mapReturnPojoFieldTypeInfo instanceof PojoTypeInfo);
> 	Assert.assertEquals(directTypeInfo, mapReturnTypeInfo);
> }
> {code}
> This test case will fail on the last two asserts because {{getMapReturnTypes}} produces a {{TypeInformation}} for {{ConcreteImpl}} with a {{GenericTypeInfo}} for the {{pojoField}}, whereas {{createTypeInformation}} correctly produces a {{PojoTypeInfo}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)