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 2019/11/19 06:18:40 UTC

[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #2223: Improve to_bitmap parse int performance

kangkaisen commented on a change in pull request #2223: Improve to_bitmap parse int performance
URL: https://github.com/apache/incubator-doris/pull/2223#discussion_r347747562
 
 

 ##########
 File path: be/test/util/string_parser_test.cpp
 ##########
 @@ -209,13 +224,59 @@ TEST(StringToInt, Limit) {
     test_int_value<int32_t>("2147483647", 2147483647, StringParser::PARSE_SUCCESS);
     test_int_value<int32_t>("-2147483648", -2147483648, StringParser::PARSE_SUCCESS);
     test_int_value<int64_t>(
-            "9223372036854775807",
-            std::numeric_limits<int64_t>::max(),
-            StringParser::PARSE_SUCCESS);
+        "9223372036854775807",
+        std::numeric_limits<int64_t>::max(),
+        StringParser::PARSE_SUCCESS);
     test_int_value<int64_t>(
-            "-9223372036854775808",
-            std::numeric_limits<int64_t>::min(),
-            StringParser::PARSE_SUCCESS);
+        "-9223372036854775808",
+        std::numeric_limits<int64_t>::min(),
+        StringParser::PARSE_SUCCESS);
+}
+
+TEST(StringToUnsignedInt, Basic) {
+    test_unsigned_int_value<uint8_t>("123", 123, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint16_t>("123", 123, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint32_t>("123", 123, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint64_t>("123", 123, StringParser::PARSE_SUCCESS);
+
+    test_unsigned_int_value<uint8_t>("123", 123, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint16_t>("12345", 12345, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint32_t>("12345678", 12345678, StringParser::PARSE_SUCCESS);
+    test_unsigned_int_value<uint64_t>("12345678901234", 12345678901234, StringParser::PARSE_SUCCESS);
+
+    test_unsigned_int_value<uint8_t>("-10", 0, StringParser::PARSE_FAILURE);
+    test_unsigned_int_value<uint16_t>("-10", 0, StringParser::PARSE_FAILURE);
+    test_unsigned_int_value<uint32_t>("-10", 0, StringParser::PARSE_FAILURE);
+    test_unsigned_int_value<uint64_t>("-10", 0, StringParser::PARSE_FAILURE);
+
+    test_unsigned_int_value<uint8_t>("+1", 0, StringParser::PARSE_FAILURE);
 
 Review comment:
   1.  unsigned integer means don't have a "+" or "-" sign
   2. In Arrow, unsigned integer parser don't accept "+" or "-" sign
   3. If we think "+" is  valid, the "-" should also be valid.

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


With regards,
Apache Git Services

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