SQL / Tuple question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SQL / Tuple question

Radu Tudoran

Hi,

 

I am trying to create an sql statement that is suppose to return a string and and integer

 

Mytable.sql(“select mystringfield,myintfield …. )

 

I am trying to give the typefinormation as a class to the

 

TypeInformation<Tuple2<String, Long>> tpinf = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();

         

.toDataStream( , tpinf.getTypeClass() )

 

However I get the following error shown below.

Can someone give me an example of some working tuples for this case.

 

 

 

Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: Tuple needs to be parameterized by using generics.

     at

 

Reply | Threaded
Open this post in threaded view
|

Re: SQL / Tuple question

Fabian Hueske-2
Hi Radu,

you can pass the TypeInfo directly without accessing the TypeClass.

Have you tried this?

TypeInformation<Tuple2<String, Long>> tpinf = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();        

.toDataStream( , tpinf )


Best, Fabian

2016-09-19 17:53 GMT+02:00 Radu Tudoran <[hidden email]>:

Hi,

 

I am trying to create an sql statement that is suppose to return a string and and integer

 

Mytable.sql(“select mystringfield,myintfield …. )

 

I am trying to give the typefinormation as a class to the

 

TypeInformation<Tuple2<String, Long>> tpinf = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();

         

.toDataStream( , tpinf.getTypeClass() )

 

However I get the following error shown below.

Can someone give me an example of some working tuples for this case.

 

 

 

Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: Tuple needs to be parameterized by using generics.

     at

 


Reply | Threaded
Open this post in threaded view
|

RE: SQL / Tuple question

Radu Tudoran

Hi Fabiane,

 

Thanks for the advice. It works this way!

 

 

From: Fabian Hueske [mailto:[hidden email]]
Sent: Monday, September 19, 2016 6:08 PM
To: [hidden email]
Subject: Re: SQL / Tuple question

 

Hi Radu,

you can pass the TypeInfo directly without accessing the TypeClass.

Have you tried this?

TypeInformation<Tuple2<String, Long>> tpinf = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();        

.toDataStream( , tpinf )

Best, Fabian

 

2016-09-19 17:53 GMT+02:00 Radu Tudoran <[hidden email]>:

Hi,

 

I am trying to create an sql statement that is suppose to return a string and and integer

 

Mytable.sql(“select mystringfield,myintfield …. )

 

I am trying to give the typefinormation as a class to the

 

TypeInformation<Tuple2<String, Long>> tpinf = new TypeHint<Tuple2<String, Long>>(){}.getTypeInfo();

         

.toDataStream( , tpinf.getTypeClass() )

 

However I get the following error shown below.

Can someone give me an example of some working tuples for this case.

 

 

 

Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: Tuple needs to be parameterized by using generics.

     at