Can Flink infers the table columns type

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

Can Flink infers the table columns type

Soheil Pourbafrani
Hi 

I want load MySQL tables in Flink without need to specifying column names and types (like what we can do in Apache Spark DataFrames). 

Using the JDBCInputFormat we should pass the table fields type in the method setRowTypeInfo. I couldn't find any way to force Flink to infer the column type.

In addition, I was wondering if it's possible to do the same using TableSource?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: Can Flink infers the table columns type

Dawid Wysakowicz-2

Hi,

Unfortunately the automatic schema inference of jdbc source is not supported yet. There is also no jdbc TableSource yet, but you should be able to write one yourself that reuses the JDBCInputFormat. You may take a look at BatchTableSource/StreamTableSource interfaces and corresponding methods to create DataSet/DataStream: StreamExecutionEnvironment.createInput/ExecutionEnvironment.createInput.

You may expect more (table) connectors in the Flink versions 1.10+. They should have the automatic schema inference when possible.

Best,

Dawid

On 02/07/2019 20:36, Soheil Pourbafrani wrote:
Hi 

I want load MySQL tables in Flink without need to specifying column names and types (like what we can do in Apache Spark DataFrames). 

Using the JDBCInputFormat we should pass the table fields type in the method setRowTypeInfo. I couldn't find any way to force Flink to infer the column type.

In addition, I was wondering if it's possible to do the same using TableSource?
thanks

signature.asc (849 bytes) Download Attachment