You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "richardantal (via GitHub)" <gi...@apache.org> on 2023/03/01 15:13:59 UTC

[GitHub] [phoenix] richardantal commented on a diff in pull request #1567: PHOENIX-5066 The TimeZone is incorrectly used during writing or reading data

richardantal commented on code in PR #1567:
URL: https://github.com/apache/phoenix/pull/1567#discussion_r1121692326


##########
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java:
##########
@@ -440,6 +445,19 @@ public void setNull(int parameterIndex, int sqlType, String typeName) throws SQL
 
     @Override
     public void setObject(int parameterIndex, Object o) throws SQLException {
+        if (o instanceof java.util.Date) {
+            //TODO add java.time when implemented
+            if (connection.isCompliantTimezoneHandling()) {
+                if (o instanceof java.sql.Timestamp) {
+                    o = DateUtil.applyInputDisplacement((java.sql.Timestamp)o);
+                } else if (o instanceof java.sql.Time) {
+                    o = DateUtil.applyInputDisplacement((java.sql.Time)o);
+                } else if (o instanceof java.sql.Date) {
+                    o = DateUtil.applyInputDisplacement((java.sql.Date)o);
+                }
+            }
+            //FIXME if we make a copy in setDate() from temporals, why not here ?

Review Comment:
   As I see we create a copy in applyInputDisplacement 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org