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

Function name is missing in error message. #11181

Open
SunRunAway opened this issue Jul 10, 2019 · 30 comments
Open

Function name is missing in error message. #11181

SunRunAway opened this issue Jul 10, 2019 · 30 comments
Labels
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/minor sig/execution SIG execution type/compatibility

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jul 10, 2019

Description

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 INET_ATON( 35 ) DIV -1;
  1. What did you expect to see?
mysql> select INET_ATON( 35 ) DIV -1;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(inet_aton(35) DIV -(1))'
  1. What did you see instead?
mysql> select INET_ATON( 35 ) DIV -1;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(35, -1)'
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    fdbc149

SIG slack channel

#sig-exec

Score

  • 300

Mentor

@SunRunAway SunRunAway added type/bug The issue is confirmed as a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. component/expression and removed component/expression labels Jul 10, 2019
@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 11, 2020

Confirming that this can still be reproduced against master.

tidb> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-745-g2b0b34b88
Edition: Community
Git Commit Hash: 2b0b34b88e43ad20f4e5ab1a0b5daf7ae6ff6046
Git Branch: master
UTC Build Time: 2020-07-09 10:12:32
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)

tidb> select INET_ATON( 35 ) DIV -1;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(35, -1)'

@danche
Copy link

danche commented Sep 6, 2020

/pick-up

@ti-challenge-bot
Copy link

It is not a pickable issue!

More

Tip : If you want this issue to be picked, you need to add a challenge-program label to it.

Warning: None

@wangbeib
Copy link

wangbeib commented Sep 8, 2020

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@myccccccc
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

This issue already picked by wangbeib.

@ti-challenge-bot
Copy link

@wangbeib You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 15, 2020
@myccccccc
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@myccccccc
Copy link
Contributor

/give-up

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 17, 2020
@ti-challenge-bot
Copy link

Give up success.

@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@TszKitLo40
Copy link
Contributor

/give-up

@ti-challenge-bot ti-challenge-bot bot removed the picked label Nov 18, 2020
@ti-challenge-bot
Copy link

Give up success.

@hidehalo
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@hidehalo
Copy link
Contributor

/give-up

@ti-challenge-bot ti-challenge-bot bot removed the picked label Nov 30, 2020
@ti-challenge-bot
Copy link

Give up success.

@XuHuaiyu
Copy link
Contributor

According to Error message or error code does not match MySQL
I'll mark this issue as a severity/minor

@HuGanghui
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@HuGanghui
Copy link
Contributor

/give-up

@ti-challenge-bot ti-challenge-bot bot removed the picked label Jan 29, 2021
@ti-challenge-bot
Copy link

Give up success.

@HuGanghui
Copy link
Contributor

HuGanghui commented Jan 31, 2021

@SunRunAway Hi, I am new to TiDB, and want to fix this issue, but something confused me, please give me some help.
When I try to change the following code : "BIGINT UNSIGNED" -> "AAAABIGINT UNSIGNED" and s.args[0].String() -> ads

before:

return 0, true, types.ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%s DIV %s)", s.args[0].String(), s.args[1].String()))

after:

return 0, true, types.ErrOverflow.GenWithStackByArgs("AAAABIGINT UNSIGNED", fmt.Sprintf("(%s DIV %s)", "sds", s.args[1].String()))

and in the unit test, it's ok, the test failed.

func (s *testEvaluatorSuite) TestArithmeticIntDivide(c *C) {

    c.Assert(err, ErrorMatches, tc.expect[1])
... error string = "[types:1690]AAAABIGINT UNSIGNED value is out of range in '(sds DIV -1)'"
... regex string = "*BIGINT UNSIGNED value is out of range in '\\(1 DIV -1\\)'"

OOPS: 0 passed, 1 FAILED
--- FAIL: TestT (0.01s)
FAIL

but when I make server, and try to test it in mysql client:

  1. Run TiDB
tiup playground --db.binpath /Users/hgh/Documents/GitHub/TiDB/tidb/bin/tidb-server
  1. mysql client connect:
mysql --host 127.0.0.1 --port 4000 -u root
  1. test, it performs as same as before I change the code, so I am confused with this situation, is any other mechanisms in tidb that make this ?
mysql> select INET_ATON(1) DIV -0.01;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(1 DIV -0.01)'
mysql>

@Tjianke
Copy link
Contributor

Tjianke commented Jan 31, 2021

@SunRunAway Hi, I am new to TiDB, and want to fix this issue, but something confused me, please give me some help.
When I try to change the following code : "BIGINT UNSIGNED" -> "AAAABIGINT UNSIGNED" and s.args[0].String() -> ads

before:

return 0, true, types.ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%s DIV %s)", s.args[0].String(), s.args[1].String()))

after:

return 0, true, types.ErrOverflow.GenWithStackByArgs("AAAABIGINT UNSIGNED", fmt.Sprintf("(%s DIV %s)", "sds", s.args[1].String()))

and in the unit test, it's ok, the test failed.

func (s *testEvaluatorSuite) TestArithmeticIntDivide(c *C) {

    c.Assert(err, ErrorMatches, tc.expect[1])
... error string = "[types:1690]AAAABIGINT UNSIGNED value is out of range in '(sds DIV -1)'"
... regex string = "*BIGINT UNSIGNED value is out of range in '\\(1 DIV -1\\)'"

OOPS: 0 passed, 1 FAILED
--- FAIL: TestT (0.01s)
FAIL

but when I make server, and try to test it in mysql client:

  1. Run TiDB
tiup playground --db.binpath /Users/hgh/Documents/GitHub/TiDB/tidb/bin/tidb-server
  1. mysql client connect:
mysql --host 127.0.0.1 --port 4000 -u root
  1. test, it performs as same as before I change the code, so I am confused with this situation, is any other mechanisms in tidb that make this ?
mysql> select INET_ATON(1) DIV -0.01;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(1 DIV -0.01)'
mysql>

To put it simply, the final error result is generated in executor/builtin_arithmetic_vec.go:716. The test raised error because it's testing row version of evaluation function evalInt, which you just changed.

Your query will call row-based evalInt during plan building period(constant folding). Once query gets executed, vectorized version vecEvalInt will be called to return final result.

@HuGanghui
Copy link
Contributor

@Tjianke I got it, thanks.

@HuGanghui
Copy link
Contributor

I think this issue is not easy, because in plan building, the INET_ATON( 35 ) will be calculated first, so when start to run DIV function, we just get constant 35 and can not get any Information about INET_ATON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/minor sig/execution SIG execution type/compatibility
Projects
None yet
Development

No branches or pull requests