lingbin commented on a change in pull request #2277: Replace boost::split() 
with strings::Split() in options
URL: https://github.com/apache/incubator-doris/pull/2277#discussion_r349871245
 
 

 ##########
 File path: be/src/olap/options.cpp
 ##########
 @@ -45,30 +55,35 @@ OLAPStatus parse_root_path(const std::string& root_path, 
StorePath* path) {
         path->path = tmp_vec[0];
 
         // parse root path capacity and storage medium
-        std::string capacity_str, medium_str;
+        std::string capacity_str;
+        std::string medium_str;
 
         boost::filesystem::path boost_path = tmp_vec[0];
-        std::string extension =
-            boost::filesystem::canonical(boost_path).extension().string();
+        std::string extension = 
boost::filesystem::canonical(boost_path).extension().string();
         if (!extension.empty()) {
             medium_str = extension.substr(1);
         }
 
         for (int i = 1; i < tmp_vec.size(); i++) {
             // <property>:<value> or <value>
-            std::string property, value;
-            std::size_t found = tmp_vec[i].find(':');
-            if (found != std::string::npos) {
-                property = boost::trim_copy(tmp_vec[i].substr(0, found));
-                value = boost::trim_copy(tmp_vec[i].substr(found + 1));
+            std::string property;
+            std::string value;
+            std::pair<std::string, std::string> pair = strings::Split(
+                    tmp_vec[i], strings::delimiter::Limit(":", 1));
+            if (!pair.second.empty()) {
+                property = pair.first;
+                value = pair.second;
             } else {
                 // <value> only supports setting capacity
-                property = "capacity";
-                value = boost::trim_copy(tmp_vec[i]);
+                property = CAPACITY;
+                value = tmp_vec[i];
             }
-            if (boost::iequals(property, "capacity")) {
+
+            StripWhiteSpace(&property);
+            StripWhiteSpace(&value);
+            if (to_upper(&property) == CAPACITY) {
                 capacity_str = value;
-            } else if (boost::iequals(property, "medium")) {
+            } else if (to_upper(&property) == MEDIUM) {
                 // property 'medium' has a higher priority than the extension 
of
                 // path, so it can override medium_str
                 medium_str = value;
 
 Review comment:
   Done.

----------------------------------------------------------------
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]

Reply via email to