I think your problem is that you declared "TupleEvent2" as a TypeVariable in your code but I think you want to use a class that you defined, right?

If so this is the correct declaration:

MySourceFunction implements SourceFunction<TupleEvent2>

On 09.03.2016 09:28, Wang Yangjun wrote:
Hello,

I think in this case you could just implement your “MySourceFunction<TupleEvent2>” both SourceFunction and ResultTypeQueryable interfaces.

MySourceFunction<TupleEvent2> implements SourceFunction<TupleEvent2>, ResultTypeQueryable< TupleEvent2 >
{
…
}

Best,
Jun

From: Radu Tudoran <radu.tudo...@huawei.com <mailto:radu.tudo...@huawei.com>> Reply-To: "user@flink.apache.org <mailto:user@flink.apache.org>" <user@flink.apache.org <mailto:user@flink.apache.org>>
Date: Wednesday 9 March 2016 at 09:41
To: "user@flink.apache.org <mailto:user@flink.apache.org>" <user@flink.apache.org <mailto:user@flink.apache.org>>
Subject: RE: ype of TypeVariable could not be determined

Hi,

The issue is that this problem appears when I want to create a stream source.

|StreamExecutionEnvironment.addSource(new MySourceFunction())|

…

Where the stream source class is

MySourceFunction<TupleEvent2> implements SourceFunction<TupleEvent2>

{

…

}

In such a case I am not sure how I can pass the outertype nor how I can pass it using the “.returns()” method as Timo suggested

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.tudo...@huawei.com <mailto:radu.tudo...@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!

*From:*Wang Yangjun [mailto:yangjun.w...@aalto.fi]
*Sent:* Tuesday, March 08, 2016 7:15 PM
*To:* user@flink.apache.org <mailto:user@flink.apache.org>
*Subject:* Re: ype of TypeVariable could not be determined

Hi Radu,

I met this issue also. The reason is outTypeInfo couldn't be created base on generic type when a transform applied.

public <R> SingleOutputStreamOperator<R, ?> transform(String operatorName, TypeInformation<R> outTypeInfo, OneInputStreamOperator<T, R> operator)

The solution would be passed Calss<T> to your UDF and create TypeInfomation<R> by yourself.

Best,

Jun

*From: *Radu Tudoran <radu.tudo...@huawei.com <mailto:radu.tudo...@huawei.com>> *Reply-To: *"user@flink.apache.org <mailto:user@flink.apache.org>" <user@flink.apache.org <mailto:user@flink.apache.org>>
*Date: *Tuesday 8 March 2016 at 19:57
*To: *"user@flink.apache.org <mailto:user@flink.apache.org>" <user@flink.apache.org <mailto:user@flink.apache.org>>
*Subject: *ype of TypeVariable could not be determined

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.tudo...@huawei.com <mailto:radu.tudo...@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!


Reply via email to