Skip to content

Commit 950521e

Browse files
authored
expression: ignore TypeNULL in HandleBinaryLiteral (pingcap#49527) (pingcap#49532)
close pingcap#49526
1 parent 4958e24 commit 950521e

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

DEPS.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5463,14 +5463,16 @@ def go_deps():
54635463
name = "com_sourcegraph_sourcegraph_appdash",
54645464
build_file_proto_mode = "disable_global",
54655465
importpath = "sourcegraph.com/sourcegraph/appdash",
5466-
sum = "h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=",
5466+
replace = "github.com/sourcegraph/appdash",
5467+
sum = "h1:IJ3DuWHPTJrsqtIqjfdmPTELdTFGefvrOa2eTeRBleQ=",
54675468
version = "v0.0.0-20190731080439-ebfcffb1b5c0",
54685469
)
54695470
go_repository(
54705471
name = "com_sourcegraph_sourcegraph_appdash_data",
54715472
build_file_proto_mode = "disable_global",
54725473
importpath = "sourcegraph.com/sourcegraph/appdash-data",
5473-
sum = "h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI=",
5474+
replace = "github.com/sourcegraph/appdash-data",
5475+
sum = "h1:8ZnTA26bBOoPkAbbitKPgNlpw0Bwt7ZlpYgZWHWJR/w=",
54745476
version = "v0.0.0-20151005221446-73f23eafcf67",
54755477
)
54765478
go_repository(

expression/builtin_convert_charset.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ func HandleBinaryLiteral(ctx sessionctx.Context, expr Expression, ec *ExprCollat
322322
return expr
323323
}
324324
return BuildToBinaryFunction(ctx, expr)
325-
} else if argChs == charset.CharsetBin && dstChs != charset.CharsetBin {
325+
} else if argChs == charset.CharsetBin && dstChs != charset.CharsetBin &&
326+
expr.GetType().GetType() != mysql.TypeNull {
326327
ft := expr.GetType().Clone()
327328
ft.SetCharset(ec.Charset)
328329
ft.SetCollate(ec.Collation)

expression/integration_test/integration_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7971,3 +7971,14 @@ func TestIssue41986(t *testing.T) {
79717971
// shouldn't report they can't find column error and return the right result.
79727972
tk.MustQuery("SELECT GROUP_CONCAT(effective_date order by stlmnt_hour DESC) FROM ( SELECT (COALESCE(pct.clearing_time, 0)/3600000) AS stlmnt_hour ,COALESCE(pct.effective_date, '1970-01-01 08:00:00') AS effective_date FROM poi_clearing_time_topic pct ORDER BY pct.effective_date DESC ) a;").Check(testkit.Rows("2023-08-25 00:00:00"))
79737973
}
7974+
7975+
func TestIssue49526(t *testing.T) {
7976+
store := testkit.CreateMockStore(t)
7977+
tk := testkit.NewTestKit(t, store)
7978+
7979+
rows := tk.MustQuery("explain select null as a union all select 'a' as a;").Rows()
7980+
for _, r := range rows {
7981+
require.NotContains(t, r[4], "from_binary")
7982+
}
7983+
tk.MustQuery("select null as a union all select 'a' as a;").Sort().Check(testkit.Rows("<nil>", "a"))
7984+
}

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,9 @@ replace (
296296
github.com/go-ldap/ldap/v3 => github.com/YangKeao/ldap/v3 v3.4.5-0.20230421065457-369a3bab1117
297297
github.com/pingcap/tidb/parser => ./parser
298298
go.opencensus.io => go.opencensus.io v0.23.1-0.20220331163232-052120675fac
299+
300+
// TODO: `sourcegraph.com/sourcegraph/appdash` has been archived, and the original host has been removed.
301+
// Please remove these dependencies.
302+
sourcegraph.com/sourcegraph/appdash => github.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
303+
sourcegraph.com/sourcegraph/appdash-data => github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
299304
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9
912912
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
913913
github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js=
914914
github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0=
915+
github.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:IJ3DuWHPTJrsqtIqjfdmPTELdTFGefvrOa2eTeRBleQ=
916+
github.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:V952P4GGl1v/MMynLwxVdWEbSZJx+n0oOO3ljnez+WU=
917+
github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:8ZnTA26bBOoPkAbbitKPgNlpw0Bwt7ZlpYgZWHWJR/w=
918+
github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:tNZjgbYncKL5HxvDULAr/mWDmFz4B7H8yrXEDlnoIiw=
915919
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
916920
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
917921
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
@@ -1616,9 +1620,5 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
16161620
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
16171621
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
16181622
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
1619-
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=
1620-
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
1621-
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI=
1622-
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
16231623
stathat.com/c/consistent v1.0.0 h1:ezyc51EGcRPJUxfHGSgJjWzJdj3NiMU9pNfLNGiXV0c=
16241624
stathat.com/c/consistent v1.0.0/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0=

0 commit comments

Comments
 (0)