jadireddi commented on a change in pull request #7558:
URL: https://github.com/apache/pinot/pull/7558#discussion_r727268941
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/function/DateTimePatternHandler.java
##########
@@ -45,10 +46,21 @@ public static String parseEpochMillisToDateTimeString(long
millis, String patter
return dateTimeFormatter.print(millis);
}
- private static DateTimeFormatter getDateTimeFormatter(String pattern) {
- // Note: withZoneUTC is overwritten if the timezone is specified directly
in the pattern
+ /**
+ * Converts the millis representing seconds since epoch into a string of
passed pattern and time zone id
+ */
+ public static String parseEpochMillisToDateTimeString(long millis, String
pattern, String timezoneId) {
+ DateTimeFormatter dateTimeFormatter = getDateTimeFormatter(pattern,
timezoneId);
+ return dateTimeFormatter.print(millis);
+ }
+
+ private static DateTimeFormatter getDateTimeFormatter(String pattern, String
timezoneId) {
// This also leverages an internal cache so it won't generate a new
DateTimeFormatter for every row with
// the same pattern
- return DateTimeFormat.forPattern(pattern).withZoneUTC();
+ return
DateTimeFormat.forPattern(pattern).withZone(DateTimeZone.forID(timezoneId));
+ }
+
+ private static DateTimeFormatter getDateTimeFormatter(String pattern) {
+ return getDateTimeFormatter(pattern, DateTimeZone.UTC.toString());
Review comment:
Minor suggestion. Can we call directly DateTimeZone.UTC. `getID()`
instead of `.toString()`. Here toString() indirectly calling getID() and to be
on the safer side for any future toString modifications from joda library.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]