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/10/19 05:37:35 UTC

[GitHub] [doris] LOVEGISER commented on pull request #13437: [Improvement](decimal) print decimal according to the real precision and scale

LOVEGISER commented on PR #13437:
URL: https://github.com/apache/doris/pull/13437#issuecomment-1283456743

   i have test,this is great
   
   `
   CREATE TABLE `test` (
     `id` varchar(32) NULL DEFAULT "",
     `user_name` varchar(32) NULL DEFAULT "",
     `member_list` DECIMAL(10,3)
   ) ENGINE=OLAP
   DUPLICATE KEY(`id`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`id`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   
   
   INSERT INTO test VALUES ('2','sim',1.000);
   INSERT INTO test VALUES ('2','sim',1.001);
   INSERT INTO test VALUES ('2','sim',1.002);
   
   mysql> select  * from test;
   +------+-----------+-------------+
   | id   | user_name | member_list |
   +------+-----------+-------------+
   | 2    | sim       |       1.002 |
   | 2    | sim       |       1.001 |
   | 2    | sim       |       1.000 |
   
   
   mysql> select  cast(avg(member_list) as DECIMAL(10,3)) from test;
   +-------------------------------------------+
   | CAST(avg(`member_list`) AS DECIMAL(10,3)) |
   +-------------------------------------------+
   |                                     1.000 |
   +-------------------------------------------+
   1 row in set (0.02 sec)
   
   `


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