Gabriel39 commented on code in PR #21898:
URL: https://github.com/apache/doris/pull/21898#discussion_r1277746763


##########
be/src/http/http_common.h:
##########
@@ -35,7 +35,7 @@ static const std::string HTTP_PARTITIONS = "partitions";
 static const std::string HTTP_TEMP_PARTITIONS = "temporary_partitions";
 static const std::string HTTP_NEGATIVE = "negative";
 static const std::string HTTP_STRICT_MODE = "strict_mode";
-static const std::string HTTP_TIMEZONE = "timezone";

Review Comment:
   We should assure backward compatibility. I suggest we just add a new 
`time_zone` and users can set through both `time_zone` and `timezone`



##########
be/src/util/timezone_utils.cpp:
##########
@@ -78,17 +84,55 @@ bool TimezoneUtils::find_cctz_time_zone(const std::string& 
timezone, cctz::time_
         offset *= positive ? 1 : -1;
         ctz = cctz::fixed_time_zone(cctz::seconds(offset));
         return true;
-    } else if (timezone_lower == "cst") {
-        // Supports offset and region timezone type, "CST" use here is 
compatibility purposes.
-        ctz = cctz::fixed_time_zone(cctz::seconds(8 * 60 * 60));
-        return true;
-    } else {
-        auto it = timezone_names_map_.find(timezone_lower);
-        if (it == timezone_names_map_.end()) {
-            return false;
+    } else { // not only offset, GMT or GMT+8
+        // split tz_name and offset
+        int split = timezone_lower.find('+') != std::string::npos ? 
timezone_lower.find('+')
+                                                                  : 
timezone_lower.find('-');
+        cctz::time_zone offset;
+        bool have_both = split != std::string::npos && split + 1 < 
timezone_lower.length() &&
+                         std::isdigit(timezone_lower[split + 1]);
+        if (have_both) {
+            auto offset_str = timezone_lower.substr(split);
+            timezone_lower = timezone_lower.substr(0, split);
+            int offset_hours = 0;
+            try {
+                offset_hours = std::stoi(offset_str);
+            } catch ([[maybe_unused]] std::exception& e) {
+                LOG(INFO) << "Unable to cast " << timezone << " as timezone";

Review Comment:
   Use LOG(WARNING) if you think this is a curial message to let users know 
otherwise LOG(DEBUG). INFO doesn't make sense here



-- 
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-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to