问题描述: 1、我有一个MySQL数据源(SourceTable Object):里面有id, name, my_time三个字段,他们的类型分别是int, String, String类型。 我使用的是JDBCInputFormat读取数据源,读取数据的SQL语句是: select id, name, my_time from mysql_source 2、当我使用sql API进行操作,操作语句如下: select id, my_time, name from table_source (检索顺序为int, String, String) 3、我定义了一个TableSink ,将第二步的结果按照id, my_time, name的次序写到MySQL,使用的是JDBCOutputFormat写出,写出SQL语句是 insert into mysql_sink(id, my_time, name) values(?, ?, ?) 但是,最终写出结果却是 id, name, my_time, 也就是说my_time字段的值和name字段的值写反了。 4、我尝试了其他SQL操作,如: select my_time, id, name from table_source (检索顺序为String, int, String) 结果完全没有问题。 请求帮助: 根据我调试,flink没有按照列名进行调整,只是根据类型进行判断,请问我应该如何修复这个问题?
Problem Description: 1, I have a MySQL data source (SourceTable Object): There are three fields id, name, my_time, their types are int, String, String type. I am using JDBCInputFormat to read the data source. The SQL statement for reading the data is: Select id, name, my_time from mysql_source 2, when I use the sql API to operate, the operation statement is as follows: Select id, my_time, name from table_source 3, I defined a TableSink, the results of the second step are written to MySQL in the order of id, my_time, name, using JDBCOutputFormat to write out, write the SQL statement is Insert into mysql_sink(id, my_time, name) values(?, ?, ?) However, the final result is Id, name, my_time, that is, the value of the my_time field and the value of the name field are reversed. 4. I tried other search orders, such as: Select my_time, id, name from table_source The result is completely ok. Ask for help: According to my debugging, flink does not adjust according to the column name, but judges according to the type. How can I fix this problem?
