pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.26k stars 5.84k forks source link

value out of range error message is difference from mysql #39251

Open hawkingrei opened 1 year ago

hawkingrei commented 1 year ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t0` (\n  `c0` blob DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
INSERT INTO `t0` VALUES (_binary '-857666283'),(_binary '-857666283'),(_binary '-857666283'),(_binary '-857666283'),(''),(''),(_binary '309580950'),(_binary '-9223372036854775808'),(_binary '0'),(_binary 'I'),(_binary '9'),(_binary '-1376946263');

SELECT /*+ AGG_TO_COP()*/t0.c0
FROM t0
WHERE (((CASE ((NULL)OR(t0.c0))
             WHEN CAST(EXPORT_SET(DEGREES(t0.c0), LN((CASE t0.c0
                                                          WHEN t0.c0 THEN 905426841
                                                          ELSE t0.c0
                                                      END)), TRUE, CAST(t0.c0 AS DECIMAL)) AS DATE) THEN '-0.0'
             WHEN t0.c0 THEN DEFAULT(t0.c0)
             ELSE DEFAULT(t0.c0)
         END)) IS NULL)

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

(1690, "BIGINT value is out of range in 'degrees(test.t0.c0)'")

3. What did you see instead (Required)

(1105, 'strconv.Atoi: parsing "623917037987283309580950130958095020": value out of range')

[2022/11/19 15:47:37.423 +08:00] [INFO] [conn.go:1152] ["command dispatched failed"] [conn=6155782973871358437] [connInfo="id:6155782973871358437, addr:127.0.0.1:53317 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="SELECT /*+ AGG_TO_COP()*/t0.c0\nFROM t0\nWHERE (((CASE ((NULL)OR(t0.c0))\n             WHEN CAST(EXPORT_SET(DEGREES(t0.c0), LN((CASE t0.c0\n                                                          WHEN t0.c0 THEN 905426841\n                                                          ELSE t0.c0\n                                                      END)), TRUE, CAST(t0.c0 AS DECIMAL)) AS DATE) THEN '-0.0'\n             WHEN t0.c0 THEN DEFAULT(t0.c0)\n             ELSE DEFAULT(t0.c0)\n         END)) IS NULL)"] [txn_mode=PESSIMISTIC] [timestamp=437477456583852033] [err="strconv.Atoi: parsing \"623917037987283309580950130958095020\": value out of range\ngithub.com/pingcap/errors.AddStack\n\t/Users/pingcap/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20220729040631-518f63d66278/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/Users/pingcap/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20220729040631-518f63d66278/juju_adaptor.go:15\ngithub.com/pingcap/tidb/types.scanTimeArgs\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/types/time.go:1239\ngithub.com/pingcap/tidb/types.parseDatetime\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/types/time.go:1154\ngithub.com/pingcap/tidb/types.parseTime\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/types/time.go:1988\ngithub.com/pingcap/tidb/types.ParseTime\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/types/time.go:1970\ngithub.com/pingcap/tidb/expression.(*builtinCastStringAsTimeSig).evalTime\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_cast.go:1302\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).EvalTime\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/scalar_function.go:426\ngithub.com/pingcap/tidb/expression.(*builtinCastTimeAsRealSig).evalReal\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_cast.go:1403\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).EvalReal\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/scalar_function.go:411\ngithub.com/pingcap/tidb/expression.CompareReal\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_compare.go:2914\ngithub.com/pingcap/tidb/expression.(*builtinEQRealSig).evalInt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_compare.go:2346\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).EvalInt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/scalar_function.go:406\ngithub.com/pingcap/tidb/expression.(*builtinCaseWhenStringSig).evalString\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_control.go:412\ngithub.com/pingcap/tidb/expression.(*builtinCaseWhenStringSig).fallbackEvalString\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_control_vec_generated.go:367\ngithub.com/pingcap/tidb/expression.(*builtinCaseWhenStringSig).vecEvalString\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_control_vec_generated.go:402\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).VecEvalString\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/scalar_function.go:58\ngithub.com/pingcap/tidb/expression.(*builtinStringIsNullSig).vecEvalInt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/builtin_string_vec.go:138\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).VecEvalInt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/scalar_function.go:48\ngithub.com/pingcap/tidb/expression.EvalExpr\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/expression.go:574\ngithub.com/pingcap/tidb/expression.VecEvalBool\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/expression.go:369\ngithub.com/pingcap/tidb/expression.vectorizedFilter\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/chunk_executor.go:489\ngithub.com/pingcap/tidb/expression.VectorizedFilterConsiderNull\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/chunk_executor.go:401\ngithub.com/pingcap/tidb/expression.VectorizedFilter\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/expression/chunk_executor.go:379\ngithub.com/pingcap/tidb/executor.(*SelectionExec).Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1585\ngithub.com/pingcap/tidb/executor.Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:329\ngithub.com/pingcap/tidb/executor.(*ExecStmt).next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1118\ngithub.com/pingcap/tidb/executor.(*recordSet).Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:153\ngithub.com/pingcap/tidb/server.(*tidbResultSet).Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/driver_tidb.go:409\ngithub.com/pingcap/tidb/server.(*clientConn).writeChunks\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2300\ngithub.com/pingcap/tidb/server.(*clientConn).writeResultset\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2243\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2110"]

4. What is your TiDB version? (Required)

master

tidb_version() | Release Version: v6.5.0-alpha
Edition: Community
Git Commit Hash: e9253f73e0696443ee08473bd72f85230dc39be3
Git Branch: heads/refs/tags/v6.5.0-alpha
UTC Build Time: 2022-11-18 14:27:50
GoVersion: go1.19.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
hawkingrei commented 1 year ago

it is just a compatibility issue.