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

Result of function BIT_OR is different from mysql. #11198

Closed
SunRunAway opened this issue Jul 11, 2019 · 1 comment
Closed

Result of function BIT_OR is different from mysql. #11198

SunRunAway opened this issue Jul 11, 2019 · 1 comment
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug. type/compatibility

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jul 11, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
select bit_or('-0.9871') ;
  1. What did you expect to see?
mysql> select bit_or('-0.9871') ;
+-------------------+
| bit_or('-0.9871') |
+-------------------+
|                 0 |
+-------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------+
| Level   | Code | Message                                      |
+---------+------+----------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '-0.9871' |
+---------+------+----------------------------------------------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> select bit_or('-0.9871') ;
+----------------------+
| bit_or('-0.9871')    |
+----------------------+
| 18446744073709551615 |
+----------------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    8c20289
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@ghost
Copy link

ghost commented Jul 14, 2020

This has been fixed in master!

select bit_or('-0.9871') ;
SHOW WARNINGS;

..

mysql> select bit_or('-0.9871') ;
+-------------------+
| bit_or('-0.9871') |
+-------------------+
|                 0 |
+-------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+----------------------------------------------+
| Level   | Code | Message                                      |
+---------+------+----------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '-0.9871' |
+---------+------+----------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-762-g77aecd4b2
Edition: Community
Git Commit Hash: 77aecd4b27e79a97215eb4fdd68f68f2ddf67d21
Git Branch: master
UTC Build Time: 2020-07-13 01:43:31
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)

I am going to close this issue now.

@ghost ghost closed this as completed Jul 14, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

No branches or pull requests

1 participant