imay commented on a change in pull request #1587: Set timezone variable in fe
URL: https://github.com/apache/incubator-doris/pull/1587#discussion_r311015470
##########
File path: fe/src/main/java/org/apache/doris/common/util/TimeUtils.java
##########
@@ -205,4 +212,29 @@ public static long timeStringToLong(String timeStr) {
}
return d.getTime();
}
+
+ // Check if the time zone_value is valid
+ public static void checkTimeZoneValid(String value) throws DdlException {
+ try {
+ // match offset type, such as +08:00, -07:00
+ Pattern p = Pattern.compile("^[+-]{1}\\d{2}\\:\\d{2}$");
+ Matcher m = p.matcher(value);
+ // it supports offset and region timezone type, "CST" use here is
compatibility purposes.
+ if (!value.contains("/") && !value.equals("CST") && !m.matches()) {
+
ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_TIME_ZONE, value);
+ }
+ if (m.matches()) {
Review comment:
you can make it better to avoid calling matches two times?
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]