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 2022/06/06 09:34:30 UTC

[GitHub] [incubator-doris] HappenLee commented on a diff in pull request #9582: [refactor](decimalv3) optimize decimal performance and precision

HappenLee commented on code in PR #9582:
URL: https://github.com/apache/incubator-doris/pull/9582#discussion_r889981738


##########
be/src/olap/tablet_meta.cpp:
##########
@@ -202,12 +202,24 @@ void TabletMeta::_init_column_from_tcolumn(uint32_t unique_id, const TColumn& tc
     EnumToString(TPrimitiveType, tcolumn.column_type.type, data_type);
     column->set_type(data_type);
 
+    uint32_t length = TabletColumn::get_field_length_by_type(tcolumn.column_type.type,
+                                                             tcolumn.column_type.len);
     if (tcolumn.column_type.type == TPrimitiveType::DECIMALV2) {
         column->set_precision(tcolumn.column_type.precision);
         column->set_frac(tcolumn.column_type.scale);
+        if (config::enable_storage_decimalv3) {
+            if (tcolumn.column_type.precision <= 9) {
+                length = sizeof(int32_t);
+                column->set_type("DECIMAL32");
+            } else if (tcolumn.column_type.precision <= 18) {

Review Comment:
   should use `MAX_DECIMAL64_PRECISION` to replace all code use `18`.
   same to `9` and `38`



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

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