You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/06/18 11:34:18 UTC

[GitHub] [incubator-doris] yangzhg commented on a change in pull request #3898: Support import true or false as boolean value

yangzhg commented on a change in pull request #3898:
URL: https://github.com/apache/incubator-doris/pull/3898#discussion_r442160165



##########
File path: be/src/olap/utils.cpp
##########
@@ -1264,6 +1265,15 @@ bool valid_datetime(const string &value_str) {
     }
 }
 
+bool valid_bool(const std::string& value_str) {
+    if (value_str == "0" || value_str == "1") {
+        return true;
+    }
+    StringParser::ParseResult result;
+    StringParser::string_to_bool(value_str.c_str(), value_str.length(), &result);

Review comment:
       "Truetest" won't be converted to `true`  because of `is_all_whitespace()`, it will return  `PARSE_FAILURE`. In additional, this is just test the string is `true` or `false` ignore case;




----------------------------------------------------------------
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:
users@infra.apache.org



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