amaliujia commented on a change in pull request #1687: [CALCITE-3612] Add
TIME/TIMESTAMP WITH TIME ZONE in optimizer
URL: https://github.com/apache/calcite/pull/1687#discussion_r361551423
##########
File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
##########
@@ -2021,6 +2023,137 @@ public static Long toTimestampWithLocalTimeZone(String
v, TimeZone timeZone) {
.getMillisSinceEpoch();
}
+ public static int timeWithTimeZoneToTime(TimeWithTimeZone ttz) {
+ return ttz.getMilliOfDay();
+ }
+
+ public static TimestampWithTimeZone
timeWithTimeZoneToTimestampWithTimeZone(int date,
+ TimeWithTimeZone ttz) {
+ long millisecond = date * DateTimeUtils.MILLIS_PER_DAY +
ttz.getMilliOfDay();
+ return new TimestampWithTimeZone(millisecond, ttz.getTimeZone());
+ }
+
+ public static String timeWithTimeZoneToString(TimeWithTimeZone ttz) {
+ String localTime = DateTimeUtils.unixTimeToString(ttz.getMilliOfDay());
+ return localTime + " " + ttz.getTimeZone().getID();
+ }
+
+ public static TimeWithTimeZone toTimeWithTimeZone(String v, TimeZone
sesstionTimeZone) {
Review comment:
rename to `stringToTimeWithTimeZone`?
----------------------------------------------------------------
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]
With regards,
Apache Git Services