[ https://issues.apache.org/jira/browse/FLINK-15445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17006054#comment-17006054 ]
Jark Wu commented on FLINK-15445: --------------------------------- Please also check that whether the result is correct as the FLINK-15379 reported and also check that whether all the JDBC drivers support the full precisions. > JDBC Table Source didn't work for Types with precision (or/and scale) > --------------------------------------------------------------------- > > Key: FLINK-15445 > URL: https://issues.apache.org/jira/browse/FLINK-15445 > Project: Flink > Issue Type: Bug > Components: Connectors / JDBC > Affects Versions: 1.10.0 > Reporter: Zhenghua Gao > Priority: Major > Fix For: 1.10.0 > > > {code:java} > public class JDBCSourceExample { > public static void main(String[] args) throws Exception { > StreamExecutionEnvironment env = > StreamExecutionEnvironment.getExecutionEnvironment(); > env.setParallelism(1); > EnvironmentSettings envSettings = EnvironmentSettings.newInstance() > .useBlinkPlanner() > .inStreamingMode() > .build(); > StreamTableEnvironment tableEnvironment = > StreamTableEnvironment.create(env, envSettings); > String mysqlCurrencyDDL = "CREATE TABLE currency (\n" + > " currency_id BIGINT,\n" + > " currency_name STRING,\n" + > " rate DOUBLE,\n" + > " currency_time TIMESTAMP(3),\n" + > " country STRING,\n" + > " timestamp6 TIMESTAMP(6),\n" + > " time6 TIME(6),\n" + > " gdp DECIMAL(10, 4)\n" + > ") WITH (\n" + > " 'connector.type' = 'jdbc',\n" + > " 'connector.url' = 'jdbc:mysql://localhost:3306/test',\n" + > " 'connector.username' = 'root'," + > " 'connector.table' = 'currency',\n" + > " 'connector.driver' = 'com.mysql.jdbc.Driver',\n" + > " 'connector.lookup.cache.max-rows' = '500', \n" + > " 'connector.lookup.cache.ttl' = '10s',\n" + > " 'connector.lookup.max-retries' = '3'" + > ")"; > tableEnvironment.sqlUpdate(mysqlCurrencyDDL); > String querySQL = "select * from currency"; > tableEnvironment.toAppendStream(tableEnvironment.sqlQuery(querySQL), > Row.class).print(); > tableEnvironment.execute("JdbcExample"); > } > }{code} > > Throws Exception: > > Exception in thread "main" org.apache.flink.table.api.ValidationException: > Type TIMESTAMP(6) of table field 'timestamp6' does not match with the > physical type TIMESTAMP(3) of the 'timestamp9' field of the TableSource > return type. -- This message was sent by Atlassian Jira (v8.3.4#803005)