From c5359cad37d578a3c067d33e6fb1eb785dbd3f15 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Mon, 18 Mar 2024 19:05:12 +0800 Subject: [PATCH] *: update pingcap/errors version (#51854) --- DEPS.bzl | 12 ++++++------ go.mod | 2 +- go.sum | 4 ++-- pkg/util/misc.go | 10 ++++------ tests/integrationtest/r/expression/misc.result | 2 +- .../r/planner/core/casetest/hint/hint.result | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index ea702b7fdfd55..46188a233bd3d 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -5897,13 +5897,13 @@ def go_deps(): name = "com_github_pingcap_errors", build_file_proto_mode = "disable_global", importpath = "github.com/pingcap/errors", - sha256 = "0223d4f1e587bf6c0cf65fca39ada14d89501a56be1dd0f6a067a7bc628c8938", - strip_prefix = "github.com/pingcap/errors@v0.11.5-0.20240311081613-f97970b88865", + sha256 = "99d36c5e5649442d9923d4b1cd7f1242faaf4071844c2e3c77497230b3f38cd7", + strip_prefix = "github.com/pingcap/errors@v0.11.5-0.20240318064555-6bd07397691f", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240311081613-f97970b88865.zip", - "http://ats.apps.svc/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240311081613-f97970b88865.zip", - "https://cache.hawkingrei.com/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240311081613-f97970b88865.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240311081613-f97970b88865.zip", + "http://bazel-cache.pingcap.net:8080/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240318064555-6bd07397691f.zip", + "http://ats.apps.svc/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240318064555-6bd07397691f.zip", + "https://cache.hawkingrei.com/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240318064555-6bd07397691f.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/github.com/pingcap/errors/com_github_pingcap_errors-v0.11.5-0.20240318064555-6bd07397691f.zip", ], ) go_repository( diff --git a/go.mod b/go.mod index 8fc203642b8a5..99859f527cd02 100644 --- a/go.mod +++ b/go.mod @@ -81,7 +81,7 @@ require ( github.com/otiai10/copy v1.2.0 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pingcap/badger v1.5.1-0.20230103063557-828f39b09b6d - github.com/pingcap/errors v0.11.5-0.20240311081613-f97970b88865 + github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c github.com/pingcap/fn v1.0.0 github.com/pingcap/kvproto v0.0.0-20240227073058-929ab83f9754 diff --git a/go.sum b/go.sum index 412d863583a2e..262448abcae31 100644 --- a/go.sum +++ b/go.sum @@ -707,8 +707,8 @@ github.com/pingcap/badger v1.5.1-0.20230103063557-828f39b09b6d/go.mod h1:p8QnkZn github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.5-0.20240311081613-f97970b88865 h1:xzbnMPvFtnqLsY5HLALUov6JU1ONyfQUXVurE/Nqb8Y= -github.com/pingcap/errors v0.11.5-0.20240311081613-f97970b88865/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f h1:FxA+NgsdHNOv+/hZGxUh8Gb3WuZqgqmxDwztEOiA1v4= +github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c h1:CgbKAHto5CQgWM9fSBIvaxsJHuGP0uM74HXtv3MyyGQ= github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c/go.mod h1:4qGtCB0QK0wBzKtFEGDhxXnSnbQApw1gc9siScUl8ew= github.com/pingcap/fn v1.0.0 h1:CyA6AxcOZkQh52wIqYlAmaVmF6EvrcqFywP463pjA8g= diff --git a/pkg/util/misc.go b/pkg/util/misc.go index 81d6bba617443..a149eaf0ffcf5 100644 --- a/pkg/util/misc.go +++ b/pkg/util/misc.go @@ -167,12 +167,10 @@ func SyntaxWarn(err error) error { } logutil.BgLogger().Debug("syntax error", zap.Error(err)) - // If the warn is already a terror with stack, pass it through. - if errors.HasStack(err) { - cause := errors.Cause(err) - if _, ok := cause.(*terror.Error); ok { - return err - } + // If the "err" is already a terror, pass it through. + cause := errors.Cause(err) + if _, ok := cause.(*terror.Error); ok { + return err } return parser.ErrParse.FastGenByArgs(syntaxErrorPrefix, err.Error()) diff --git a/tests/integrationtest/r/expression/misc.result b/tests/integrationtest/r/expression/misc.result index e55f8fc4fe65d..c6e95ea94f305 100644 --- a/tests/integrationtest/r/expression/misc.result +++ b/tests/integrationtest/r/expression/misc.result @@ -242,7 +242,7 @@ Warning 8061 Optimizer hint unknown_hint is not supported by TiDB and is ignored select 1 from /*+ test1() */ t; 1 Level Code Message -Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. +Warning 8066 Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. drop table if exists t; create table t(a bigint, b double, c decimal, d varchar(20), e datetime, f time, g json); insert into t values(1, 1.1, 2.2, "abc", "2018-10-24", NOW(), "12"); diff --git a/tests/integrationtest/r/planner/core/casetest/hint/hint.result b/tests/integrationtest/r/planner/core/casetest/hint/hint.result index a47430e2f2a85..1fd67eb399eed 100644 --- a/tests/integrationtest/r/planner/core/casetest/hint/hint.result +++ b/tests/integrationtest/r/planner/core/casetest/hint/hint.result @@ -8,12 +8,12 @@ select count(*) /*+ stream_agg() */ from t where a > 1; count(*) /*+ stream_agg() 0 Level Code Message -Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. +Warning 8066 Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. select count(*) from (select count(*) as a /*+ stream_agg() */ from t where b > 1 group by b) t1 where a > 1; count(*) 0 Level Code Message -Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. +Warning 8066 Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc. set tidb_cost_model_version=2; drop table if exists t, t1, th; drop view if exists v, v1;