Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccurate return type of plus between bit and int #26887

Closed
yuqi1129 opened this issue Aug 4, 2021 · 1 comment · Fixed by #26888
Closed

Inaccurate return type of plus between bit and int #26887

yuqi1129 opened this issue Aug 4, 2021 · 1 comment · Fixed by #26888
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@yuqi1129
Copy link
Contributor

yuqi1129 commented Aug 4, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Master branch and execute the following sql

2. What did you expect to see? (Required)

MySQL 5.7

mysql> select d_bit + d_smallint, d_bit + d_decimal from all_types;
Field   1:  `d_bit + d_smallint`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     11
Max_length: 2
Decimals:   0
Flags:      UNSIGNED BINARY NUM

Field   2:  `d_bit + d_decimal`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     15
Max_length: 5
Decimals:   2
Flags:      BINARY NUM


+--------------------+-------------------+
| d_bit + d_smallint | d_bit + d_decimal |
+--------------------+-------------------+
|                 13 |             22.23 |
+--------------------+-------------------+
1 row in set (0.02 sec)

bit + smallint return LONGLONG and bit + decimal return NEWDECIMAL*

3. What did you see instead (Required)

mysql> select d_bit + d_smallint, d_bit + d_decimal from all_types;
No connection. Trying to reconnect...
Connection id:    3
Current database: test

Field   1:  `d_bit + d_smallint`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       DOUBLE
Collation:  binary (63)
Length:     0
Max_length: 2
Decimals:   31
Flags:      NOT_NULL BINARY NUM

Field   2:  `d_bit + d_decimal`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       DOUBLE
Collation:  binary (63)
Length:     0
Max_length: 5
Decimals:   31
Flags:      NOT_NULL BINARY NUM


+--------------------+-------------------+
| d_bit + d_smallint | d_bit + d_decimal |
+--------------------+-------------------+
|                 13 |             22.23 |
+--------------------+-------------------+
1 row in set (0.00 sec)

bit + smallint return DOUBLE and bit + decimal return DOUBLE

4. What is your TiDB version? (Required)

@yuqi1129 yuqi1129 added the type/bug The issue is confirmed as a bug. label Aug 4, 2021
@rebelice rebelice added the sig/execution SIG execution label Aug 5, 2021
@winoros winoros removed the sig/planner SIG: Planner label Aug 16, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants