Bug #109363 | 0 changed to -0 caused by DISTINCT and UNION ALL | ||
---|---|---|---|
Submitted: | 13 Dec 2022 13:08 | Modified: | 16 Dec 2022 14:50 |
Reporter: | ZongYin Hao | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.4, 8.0.31 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | distinct, regression, UNION ALL, zero |
[13 Dec 2022 13:08]
ZongYin Hao
[13 Dec 2022 13:26]
MySQL Verification Team
Hi Mr. Hao, Thank you for your bug report. However, this is not a bug. Simply, you are mixing incompatible types and domains in the expressions, which can lead to the undetermined results. Primarily, you are mixing integer with floating point and with date values. The problem is exhibited with UNION, only because UNION has to reconcile the unreconcilable domains. Not a bug.
[13 Dec 2022 13:26]
MySQL Verification Team
Hello ZongYin Hao, Thank you for the report and test case. regards, Umesh
[14 Dec 2022 8:09]
Roy Lyseng
Posted by developer: This is a minor problem since the float values 0 and -0 are two different representations of the number zero.
[16 Dec 2022 12:56]
ZongYin Hao
Sorry, I won't submit such minor bugs in the future.
[16 Dec 2022 13:45]
huahua xu
Hi all: The minor problem is caused by the method `Field_double::store`, who calls `Field_real::truncate`. ``` Field_real::Truncate_result Field_real::truncate(double *nr, double max_value) { ... /* Check for infinity so we don't get NaN in calculations */ if (!std::isinf(*nr)) { double tmp = rint((*nr - floor(*nr)) * log_10[dec]) / log_10[dec]; *nr = floor(*nr) + tmp; } ... } ```
[16 Dec 2022 13:49]
MySQL Verification Team
Thank you for your contribution. It is our standpoint that all bugs should be fixed, whether major or minor.
[16 Dec 2022 14:50]
ZongYin Hao
Wow, thank you for your great work, too!