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
[[email protected]](mailto:[email protected]) 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]