You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "dujl (via GitHub)" <gi...@apache.org> on 2023/06/12 04:04:53 UTC

[GitHub] [doris] dujl opened a new pull request, #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

dujl opened a new pull request, #20688:
URL: https://github.com/apache/doris/pull/20688

   ## Proposed changes
   
   Issue Number: close #xxx
   in round function, when the src data is decimalv3 and the scale parameter is large than src data's scale, the round result scale will be set to source data's scale, but it use scale parameter to create the result column. This will result in the round result is wrong.
   ```
   CREATE TABLE `tb_round_decimal` (
             `id` int NOT NULL COMMENT '',
             `d1` decimalv3(9, 4) NULL COMMENT '',
             `d2` decimalv3(27, 4)  NULL DEFAULT "0" ,
             `d3` decimalv3(38, 4)  NULL
           ) ENGINE=OLAP
           UNIQUE KEY(`id`)
           DISTRIBUTED BY HASH(`id`) BUCKETS 10
           PROPERTIES (
           "replication_allocation" = "tag.location.default: 1"
           ); 
   
   
   insert into tb_round_decimal values (1, 123.56789, 234.67895, 345.78956); 
   insert into tb_round_decimal values (2, 123.56789, 234.67895, 345.78956); 
   
   select cast(round(sum(d1), 6) as double), cast(round(sum(d2), 6) as double), cast(round(sum(d3), 6) as double) from tb_round_decimal ;
   ```
   before:
   ```
   2.471356	  4.693578	6.91579
   ```
   after:
   ```
   247.1356	469.3578	691.579
   ```
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


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


[GitHub] [doris] github-actions[bot] commented on pull request #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20688:
URL: https://github.com/apache/doris/pull/20688#issuecomment-1586671396

   PR approved by anyone and no changes requested.


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


[GitHub] [doris] dujl commented on pull request #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

Posted by "dujl (via GitHub)" <gi...@apache.org>.
dujl commented on PR #20688:
URL: https://github.com/apache/doris/pull/20688#issuecomment-1586739989

   run buildall


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


[GitHub] [doris] dujl commented on pull request #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

Posted by "dujl (via GitHub)" <gi...@apache.org>.
dujl commented on PR #20688:
URL: https://github.com/apache/doris/pull/20688#issuecomment-1586666812

   @Gabriel39 help to review, this pr is for doris 1.2


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


[GitHub] [doris] github-actions[bot] commented on pull request #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20688:
URL: https://github.com/apache/doris/pull/20688#issuecomment-1586671363

   PR approved by at least one committer and no changes requested.


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


[GitHub] [doris] yiguolei merged pull request #20688: [fix](decimalv3) fix result error when cast a round decimalv3 to double

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #20688:
URL: https://github.com/apache/doris/pull/20688


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