expression: limit valid decimal length (#28466)

This commit is contained in:
Zhuhe Fang
2021-10-08 14:49:23 +08:00
committed by GitHub
parent d6e19a6938
commit a18e05d2f7
4 changed files with 112 additions and 93 deletions

View File

@ -1899,7 +1899,7 @@ func WrapWithCastAsDecimal(ctx sessionctx.Context, expr Expression) Expression {
if expr.GetType().EvalType() == types.ETInt {
tp.Flen = mysql.MaxIntWidth
}
if tp.Flen == types.UnspecifiedLength {
if tp.Flen == types.UnspecifiedLength || tp.Flen > mysql.MaxDecimalWidth {
tp.Flen = mysql.MaxDecimalWidth
}
types.SetBinChsClnFlag(tp)

View File

@ -3237,7 +3237,7 @@ func (s *testIntegrationSerialSuite) TestPushDownProjectionForTiFlash(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t (id int, value decimal(6,3))")
tk.MustExec("create table t (id int, value decimal(6,3), name char(128))")
tk.MustExec("analyze table t")
tk.MustExec("set session tidb_allow_mpp=OFF")
@ -3277,7 +3277,7 @@ func (s *testIntegrationSerialSuite) TestPushDownProjectionForMPP(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t (id int, value decimal(6,3))")
tk.MustExec("create table t (id int, value decimal(6,3), name char(128))")
tk.MustExec("analyze table t")
// Create virtual tiflash replica info.

View File

@ -219,7 +219,8 @@
"desc format = 'brief' select * from t right join (select id-2 as b from t) A on A.b=t.id",
"desc format = 'brief' select A.b, B.b from (select id-2 as b from t) B join (select id-2 as b from t) A on A.b=B.b",
"desc format = 'brief' select A.id from t as A where exists (select 1 from t where t.id=A.id)",
"desc format = 'brief' select A.id from t as A where not exists (select 1 from t where t.id=A.id)"
"desc format = 'brief' select A.id from t as A where not exists (select 1 from t where t.id=A.id)",
"desc format = 'brief' SELECT FROM_UNIXTIME(name,'%Y-%m-%d') FROM t;"
]
},
{
@ -238,7 +239,8 @@
"desc format = 'brief' select A.b, B.b from (select id-2 as b from t) B join (select id-2 as b from t) A on A.b=B.b",
"desc format = 'brief' select id from t as A where exists (select 1 from t where t.id=A.id)",
"desc format = 'brief' select id from t as A where not exists (select 1 from t where t.id=A.id)",
"desc format = 'brief' select b*2, id from (select avg(value+2) as b, id from t group by id) C order by id"
"desc format = 'brief' select b*2, id from (select avg(value+2) as b, id from t group by id) C order by id",
"desc format = 'brief' SELECT FROM_UNIXTIME(name,'%Y-%m-%d') FROM t;"
]
},
{

View File

@ -1578,58 +1578,58 @@
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ count(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#7)->Column#5",
"HashAgg 1.00 root funcs:count(Column#8)->Column#6",
"└─TableReader 1.00 root data:HashAgg",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#9)->Column#7",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#9",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ count(*) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#6)->Column#5",
"HashAgg 1.00 root funcs:count(Column#7)->Column#6",
"└─TableReader 1.00 root data:HashAgg",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#7",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ sum(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:sum(Column#7)->Column#5",
"HashAgg 1.00 root funcs:sum(Column#8)->Column#6",
"└─TableReader 1.00 root data:HashAgg",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#9)->Column#7",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#9",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(b) from (select id + 1 as b from t)A",
"Plan": [
"StreamAgg 1.00 root funcs:count(Column#7)->Column#5",
"StreamAgg 1.00 root funcs:count(Column#8)->Column#6",
"└─TableReader 1.00 root data:StreamAgg",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:count(Column#9)->Column#7",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#9",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:count(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(*) from (select id + 1 as b from t)A",
"Plan": [
"StreamAgg 1.00 root funcs:count(Column#6)->Column#5",
"StreamAgg 1.00 root funcs:count(Column#7)->Column#6",
"└─TableReader 1.00 root data:StreamAgg",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#6",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#7",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ sum(b) from (select id + 1 as b from t)A",
"Plan": [
"StreamAgg 1.00 root funcs:sum(Column#7)->Column#5",
"StreamAgg 1.00 root funcs:sum(Column#8)->Column#6",
"└─TableReader 1.00 root data:StreamAgg",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#9)->Column#7",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#9",
" └─StreamAgg 1.00 batchCop[tiflash] funcs:sum(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
@ -1637,11 +1637,11 @@
"SQL": "desc format = 'brief' select * from (select id-2 as b from t) B join (select id-2 as b from t) A on A.b=B.b",
"Plan": [
"TableReader 10000.00 root data:HashJoin",
"└─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#4, Column#8)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#4",
"└─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#5, Column#10)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#5",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#8",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#10",
" └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
@ -1650,8 +1650,8 @@
"SQL": "desc format = 'brief' select * from t join (select id-2 as b from t) A on A.b=t.id",
"Plan": [
"TableReader 10000.00 root data:HashJoin",
"└─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(test.t.id, Column#7)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
"└─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(test.t.id, Column#9)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─Selection(Probe) 9990.00 cop[tiflash] not(isnull(test.t.id))",
@ -1662,8 +1662,8 @@
"SQL": "desc format = 'brief' select * from t left join (select id-2 as b from t) A on A.b=t.id",
"Plan": [
"TableReader 10000.00 root data:HashJoin",
"└─HashJoin 10000.00 cop[tiflash] left outer join, equal:[eq(test.t.id, Column#7)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
"└─HashJoin 10000.00 cop[tiflash] left outer join, equal:[eq(test.t.id, Column#9)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─TableFullScan(Probe) 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
@ -1673,23 +1673,23 @@
"SQL": "desc format = 'brief' select * from t right join (select id-2 as b from t) A on A.b=t.id",
"Plan": [
"TableReader 12487.50 root data:HashJoin",
"└─HashJoin 12487.50 cop[tiflash] right outer join, equal:[eq(test.t.id, Column#7)]",
"└─HashJoin 12487.50 cop[tiflash] right outer join, equal:[eq(test.t.id, Column#9)]",
" ├─Selection(Build) 9990.00 cop[tiflash] not(isnull(test.t.id))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─Projection(Probe) 10000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
" └─Projection(Probe) 10000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select A.b, B.b from (select id-2 as b from t) B join (select id-2 as b from t) A on A.b=B.b",
"Plan": [
"Projection 10000.00 root Column#8, Column#4",
"Projection 10000.00 root Column#10, Column#5",
"└─TableReader 10000.00 root data:HashJoin",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#4, Column#8)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#4",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#5, Column#10)]",
" ├─Projection(Build) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#5",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#8",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#10",
" └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
@ -1713,6 +1713,14 @@
" ├─TableFullScan(Build) 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo, global read",
" └─TableFullScan(Probe) 10000.00 cop[tiflash] table:A keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' SELECT FROM_UNIXTIME(name,'%Y-%m-%d') FROM t;",
"Plan": [
"Projection 10000.00 root from_unixtime(cast(test.t.name, decimal(65,0) BINARY), %Y-%m-%d)->Column#5",
"└─TableReader 10000.00 root data:TableFullScan",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
}
]
},
@ -1722,50 +1730,18 @@
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ count(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#8)->Column#5",
"HashAgg 1.00 root funcs:count(Column#9)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#10",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#11)->Column#9",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#11",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ count(*) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#7)->Column#5",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#7",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ sum(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:sum(Column#8)->Column#5",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#10)->Column#8",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#9)->Column#5",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#10)->Column#9",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#10",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(*) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#8)->Column#5",
"HashAgg 1.00 root funcs:count(Column#8)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#8",
@ -1773,13 +1749,45 @@
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ sum(b) from (select id + 1 as b from t)A",
"SQL": "desc format = 'brief' select /*+ hash_agg()*/ sum(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:sum(Column#9)->Column#5",
"HashAgg 1.00 root funcs:sum(Column#9)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#10)->Column#9",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#10",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#11)->Column#9",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#11",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#10)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(Column#11)->Column#10",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#11",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ count(*) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:count(Column#9)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#9",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' select /*+ stream_agg()*/ sum(b) from (select id + 1 as b from t)A",
"Plan": [
"HashAgg 1.00 root funcs:sum(Column#10)->Column#6",
"└─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 batchCop[tiflash] funcs:sum(Column#11)->Column#10",
" └─Projection 10000.00 batchCop[tiflash] cast(plus(test.t.id, 1), decimal(41,0) BINARY)->Column#11",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
@ -1788,14 +1796,14 @@
"Plan": [
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 cop[tiflash] ExchangeType: PassThrough",
" └─Projection 10000.00 cop[tiflash] plus(Column#4, Column#8)->Column#9",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#4, Column#8)]",
" └─Projection 10000.00 cop[tiflash] plus(Column#5, Column#10)->Column#11",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#5, Column#10)]",
" ├─ExchangeReceiver(Build) 8000.00 cop[tiflash] ",
" │ └─ExchangeSender 8000.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#4",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#5",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#8",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#10",
" └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
@ -1805,10 +1813,10 @@
"Plan": [
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 cop[tiflash] ExchangeType: PassThrough",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(test.t.id, Column#7)]",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(test.t.id, Column#9)]",
" ├─ExchangeReceiver(Build) 8000.00 cop[tiflash] ",
" │ └─ExchangeSender 8000.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─Selection(Probe) 9990.00 cop[tiflash] not(isnull(test.t.id))",
@ -1820,10 +1828,10 @@
"Plan": [
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 cop[tiflash] ExchangeType: PassThrough",
" └─HashJoin 10000.00 cop[tiflash] left outer join, equal:[eq(test.t.id, Column#7)]",
" └─HashJoin 10000.00 cop[tiflash] left outer join, equal:[eq(test.t.id, Column#9)]",
" ├─ExchangeReceiver(Build) 8000.00 cop[tiflash] ",
" │ └─ExchangeSender 8000.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─TableFullScan(Probe) 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
@ -1834,12 +1842,12 @@
"Plan": [
"TableReader 12487.50 root data:ExchangeSender",
"└─ExchangeSender 12487.50 cop[tiflash] ExchangeType: PassThrough",
" └─HashJoin 12487.50 cop[tiflash] right outer join, equal:[eq(test.t.id, Column#7)]",
" └─HashJoin 12487.50 cop[tiflash] right outer join, equal:[eq(test.t.id, Column#9)]",
" ├─ExchangeReceiver(Build) 9990.00 cop[tiflash] ",
" │ └─ExchangeSender 9990.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Selection 9990.00 cop[tiflash] not(isnull(test.t.id))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─Projection(Probe) 10000.00 cop[tiflash] minus(test.t.id, 2)->Column#7",
" └─Projection(Probe) 10000.00 cop[tiflash] minus(test.t.id, 2)->Column#9",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
},
@ -1848,14 +1856,14 @@
"Plan": [
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 cop[tiflash] ExchangeType: PassThrough",
" └─Projection 10000.00 cop[tiflash] Column#8, Column#4",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#4, Column#8)]",
" └─Projection 10000.00 cop[tiflash] Column#10, Column#5",
" └─HashJoin 10000.00 cop[tiflash] inner join, equal:[eq(Column#5, Column#10)]",
" ├─ExchangeReceiver(Build) 8000.00 cop[tiflash] ",
" │ └─ExchangeSender 8000.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#4",
" │ └─Projection 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#5",
" │ └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#8",
" └─Projection(Probe) 8000.00 cop[tiflash] minus(test.t.id, 2)->Column#10",
" └─Selection 8000.00 cop[tiflash] not(isnull(minus(test.t.id, 2)))",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
@ -1892,15 +1900,24 @@
"Sort 8000.00 root test.t.id",
"└─TableReader 8000.00 root data:ExchangeSender",
" └─ExchangeSender 8000.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─Projection 8000.00 batchCop[tiflash] mul(Column#4, 2)->Column#5, test.t.id",
" └─Projection 8000.00 batchCop[tiflash] div(Column#4, cast(case(eq(Column#19, 0), 1, Column#19), decimal(20,0) BINARY))->Column#4, test.t.id",
" └─HashAgg 8000.00 batchCop[tiflash] group by:test.t.id, funcs:sum(Column#20)->Column#19, funcs:sum(Column#21)->Column#4, funcs:firstrow(test.t.id)->test.t.id",
" └─Projection 8000.00 batchCop[tiflash] mul(Column#5, 2)->Column#6, test.t.id",
" └─Projection 8000.00 batchCop[tiflash] div(Column#5, cast(case(eq(Column#20, 0), 1, Column#20), decimal(20,0) BINARY))->Column#5, test.t.id",
" └─HashAgg 8000.00 batchCop[tiflash] group by:test.t.id, funcs:sum(Column#21)->Column#20, funcs:sum(Column#22)->Column#5, funcs:firstrow(test.t.id)->test.t.id",
" └─ExchangeReceiver 8000.00 batchCop[tiflash] ",
" └─ExchangeSender 8000.00 batchCop[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.id, collate: N/A]",
" └─HashAgg 8000.00 batchCop[tiflash] group by:Column#25, funcs:count(Column#23)->Column#20, funcs:sum(Column#24)->Column#21",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.value, 2)->Column#23, plus(test.t.value, 2)->Column#24, test.t.id",
" └─HashAgg 8000.00 batchCop[tiflash] group by:Column#26, funcs:count(Column#24)->Column#21, funcs:sum(Column#25)->Column#22",
" └─Projection 10000.00 batchCop[tiflash] plus(test.t.value, 2)->Column#24, plus(test.t.value, 2)->Column#25, test.t.id",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "desc format = 'brief' SELECT FROM_UNIXTIME(name,'%Y-%m-%d') FROM t;",
"Plan": [
"TableReader 10000.00 root data:ExchangeSender",
"└─ExchangeSender 10000.00 cop[tiflash] ExchangeType: PassThrough",
" └─Projection 10000.00 cop[tiflash] from_unixtime(cast(test.t.name, decimal(65,0) BINARY), %Y-%m-%d)->Column#5",
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo"
]
}
]
},