imay commented on a change in pull request #697: Optimize decimal by 
introducing decimal_v2 (#695)
URL: https://github.com/apache/incubator-doris/pull/697#discussion_r262961507
 
 

 ##########
 File path: be/src/util/string_parser.hpp
 ##########
 @@ -495,6 +500,193 @@ inline int 
StringParser::StringParseTraits<__int128>::max_ascii_len() {
     return 39;
 }
 
+inline __int128 StringParser::get_scale_multiplier(int scale) {
+  DCHECK_GE(scale, 0);
+  static const __int128 values[] = {
+      static_cast<__int128>(1ll),
+      static_cast<__int128>(10ll),
+      static_cast<__int128>(100ll),
+      static_cast<__int128>(1000ll),
+      static_cast<__int128>(10000ll),
+      static_cast<__int128>(100000ll),
+      static_cast<__int128>(1000000ll),
+      static_cast<__int128>(10000000ll),
+      static_cast<__int128>(100000000ll),
+      static_cast<__int128>(1000000000ll),
+      static_cast<__int128>(10000000000ll),
+      static_cast<__int128>(100000000000ll),
+      static_cast<__int128>(1000000000000ll),
+      static_cast<__int128>(10000000000000ll),
+      static_cast<__int128>(100000000000000ll),
+      static_cast<__int128>(1000000000000000ll),
+      static_cast<__int128>(10000000000000000ll),
+      static_cast<__int128>(100000000000000000ll),
+      static_cast<__int128>(1000000000000000000ll),
+      static_cast<__int128>(1000000000000000000ll) * 10ll,
+      static_cast<__int128>(1000000000000000000ll) * 100ll,
+      static_cast<__int128>(1000000000000000000ll) * 1000ll,
+      static_cast<__int128>(1000000000000000000ll) * 10000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000ll,
+      static_cast<__int128>(1000000000000000000ll) * 1000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 10000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 1000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 10000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 1000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 10000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 1000000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 10000000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000000000ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000000000ll * 
10ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000000000ll * 
100ll,
+      static_cast<__int128>(1000000000000000000ll) * 100000000000000000ll * 
1000ll};
+  if (scale >= 0 && scale < 39) return values[scale];
+  return -1;  // Overflow
+}
+
+inline __int128 StringParser::string_to_decimal(const char* s, int len,
+       int type_precision, int type_scale, ParseResult* result) {
+  // Special cases:
 
 Review comment:
   you should change indent width to 4 spaces

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