You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Timo Walther <tw...@apache.org> on 2016/03/09 08:34:10 UTC

Re: ype of TypeVariable could not be determined

Hi Radu,

the exception can have multiple causes. It would be great if you could 
share some example code. In most cases the problem is the following:

public class MapFunction<IN, OUT> { ....}

new MapFunction<String, WhatEverType>();

The type WhatEverType is type erasured by Java. The type must not be 
declared in the "new" call but in the functions signature (IN,OUT) to 
order to be preserved. Alternatively you can pass the type manually by 
using the ".returns()" method or let the function implement the 
"ResultTypeQueryable" interface.

Hope that helps.

Regards,
Timo


On 08.03.2016 18:57, Radu Tudoran wrote:
>
> Hi,
>
> I am trying to create a custom stream source. I first build this with 
> generic and I run into problems regarding type extraction. I tried to 
> put concrete types but run into the same issue (see errors below). Can 
> anyone provide a solution to solve this issue.
>
> Caused by: 
> _org.apache.flink.api.common.functions.InvalidTypesException_: Type of 
> TypeVariable 'IN' in 'class test.MySourceFunction' could not be 
> determined. This is most likely a type erasure problem. The type 
> extraction currently supports types with generic variables only in 
> cases where all variables in the return type can be deduced from the 
> input type(s).
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfoWithTypeHierarchy(_TypeExtractor.java:498_)
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.privateCreateTypeInfo(_TypeExtractor.java:380_)
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfo(_TypeExtractor.java:346_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1152_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1107_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1089_)
>
> ... 1 more
>
> Caused by: 
> _org.apache.flink.api.common.functions.InvalidTypesException_: Type of 
> TypeVariable 'TupleEvent2' in 'class test.MySourceFunctionTuple' could 
> not be determined. This is most likely a type erasure problem. The 
> type extraction currently supports types with generic variables only 
> in cases where all variables in the return type can be deduced from 
> the input type(s).
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfoWithTypeHierarchy(_TypeExtractor.java:498_)
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.privateCreateTypeInfo(_TypeExtractor.java:380_)
>
> at 
> org.apache.flink.api.java.typeutils.TypeExtractor.createTypeInfo(_TypeExtractor.java:346_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1152_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1107_)
>
> at 
> org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.addSource(_StreamExecutionEnvironment.java:1089_)
>
> ... 1 more
>
> Dr. Radu Tudoran
>
> Research Engineer - Big Data Expert
>
> IT R&D Division
>
> cid:image007.jpg@01CD52EB.AD060EE0
>
> HUAWEI TECHNOLOGIES Duesseldorf GmbH
>
> European Research Center
>
> Riesstrasse 25, 80992 München
>
> E-mail: _radu.tudoran@huawei.com_
>
> Mobile: +49 15209084330
>
> Telephone: +49 891588344173
>
> HUAWEI TECHNOLOGIES Duesseldorf GmbH
> Hansaallee 205, 40549 Düsseldorf, Germany, www.huawei.com 
> <http://www.huawei.com/>
> Registered Office: Düsseldorf, Register Court Düsseldorf, HRB 56063,
> Managing Director: Bo PENG, Wanzhou MENG, Lifang CHEN
> Sitz der Gesellschaft: Düsseldorf, Amtsgericht Düsseldorf, HRB 56063,
> Geschäftsführer: Bo PENG, Wanzhou MENG, Lifang CHEN
>
> This e-mail and its attachments contain confidential information from 
> HUAWEI, which is intended only for the person or entity whose address 
> is listed above. Any use of the information contained herein in any 
> way (including, but not limited to, total or partial disclosure, 
> reproduction, or dissemination) by persons other than the intended 
> recipient(s) is prohibited. If you receive this e-mail in error, 
> please notify the sender by phone or email immediately and delete it!
>