You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/12/06 00:53:22 UTC

[GitHub] [calcite] freastro commented on a diff in pull request #2995: [CALCITE-5414] Use DateTimeUtils to correctly convert between java.sql types and unix timestamps

freastro commented on code in PR #2995:
URL: https://github.com/apache/calcite/pull/2995#discussion_r1040273603


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2006,15 +1997,11 @@ public static long toLong(Timestamp v) {
     return toLong(v, LOCAL_TZ);
   }
 
-  // mainly intended for java.sql.Timestamp but works for other dates also
-  @SuppressWarnings("JavaUtilDate")
-  public static long toLong(java.util.Date v, TimeZone timeZone) {
-    final long time = v.getTime();
-    return time + timeZone.getOffset(time);
+  public static long toLong(Timestamp v, TimeZone timeZone) {

Review Comment:
   I updated the javadoc on the method in `SqlFunctions` that I touched. Most of it is a copy & paste from the methods I added to `DateTimeUtils`, but I thought it would be useful to re-explain it here too.



-- 
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: commits-unsubscribe@calcite.apache.org

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