-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Fix failure of insertion of timestamp on JDBC #8201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,13 +26,15 @@ | |
| import java.sql.PreparedStatement; | ||
| import java.sql.SQLException; | ||
| import java.sql.SQLNonTransientException; | ||
| import java.sql.Timestamp; | ||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| import static com.facebook.presto.plugin.jdbc.JdbcErrorCode.JDBC_ERROR; | ||
| import static com.facebook.presto.plugin.jdbc.JdbcErrorCode.JDBC_NON_TRANSIENT_ERROR; | ||
| import static com.facebook.presto.spi.type.DateType.DATE; | ||
| import static com.facebook.presto.spi.type.TimestampType.TIMESTAMP; | ||
| import static com.google.common.base.Preconditions.checkState; | ||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||
|
|
||
|
|
@@ -130,6 +132,11 @@ public void appendLong(long value) | |
| long localMillis = ISOChronology.getInstanceUTC().getZone().getMillisKeepLocal(DateTimeZone.getDefault(), utcMillis); | ||
| statement.setDate(next(), new Date(localMillis)); | ||
| } | ||
| else if (TIMESTAMP.equals(columnTypes.get(field))) { | ||
| long utcMillis = TimeUnit.MILLISECONDS.toMillis(value); | ||
| long localMillis = ISOChronology.getInstanceUTC().getZone().getMillisKeepLocal(DateTimeZone.getDefault(), utcMillis); | ||
| statement.setTimestamp(next(), new Timestamp(localMillis)); | ||
|
||
| } | ||
| else { | ||
| statement.setLong(next(), value); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been addressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same portion of code as below, we decide to keep it as this for now.