huaxingao commented on pull request #29043: URL: https://github.com/apache/spark/pull/29043#issuecomment-657009038
@TJX2014 Actually, regardless of time zone, map `timestamp` to `datetime` in mysql dialect doesn't seem to solve your problem. Suppose you create a table with a `timestamp` column CREATE TABLE test (c timestamp); You want to insert a timestamp '1111-01-01 00:00:01' to TABLE test. Before your fix, when inserting this timestamp '1111-01-01 00:00:01' to table test, mysql JDBC driver does the range check for this timestamp value and throw Exception because timestamp '1111-01-01 00:00:01' is not valid (mysql TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC) After your fix, when inserting this timestamp '1111-01-01 00:00:01' to table test, since you change the data type to `datetime` now, mysql JDBC driver doesn't throw Exception since '1111-01-01 00:00:01' is a valid `datetime` value, but when inserting this value into table test, because the real type of column c is timestamp, mysql will throw Exception since '1111-01-01 00:00:01' is not a valid timestamp value. I don't have mysql database and JDBC driver on my local to test this, but in theory it works this way. You may want to try to see if you can insert this timestamp '1111-01-01 00:00:01' OK. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
