diff --git a/expression/builtin_cast.go b/expression/builtin_cast.go index 9d6becab44cbe..7b18050e3bd16 100644 --- a/expression/builtin_cast.go +++ b/expression/builtin_cast.go @@ -1883,6 +1883,12 @@ func WrapWithCastAsDecimal(ctx sessionctx.Context, expr Expression) Expression { if expr.GetType().EvalType() == types.ETInt { tp.Flen = mysql.MaxIntWidth } +<<<<<<< HEAD +======= + if tp.Flen == types.UnspecifiedLength || tp.Flen > mysql.MaxDecimalWidth { + tp.Flen = mysql.MaxDecimalWidth + } +>>>>>>> a18e05d2f... expression: limit valid decimal length (#28466) types.SetBinChsClnFlag(tp) tp.Flag |= expr.GetType().Flag & mysql.UnsignedFlag return BuildCastFunction(ctx, expr, tp) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 2ad2a529e85fa..a8db9802903cd 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -3199,7 +3199,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") @@ -3239,7 +3239,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. diff --git a/planner/core/testdata/integration_serial_suite_in.json b/planner/core/testdata/integration_serial_suite_in.json index 6e720ec29065c..8243d6382ca9a 100644 --- a/planner/core/testdata/integration_serial_suite_in.json +++ b/planner/core/testdata/integration_serial_suite_in.json @@ -217,7 +217,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;" ] }, { @@ -236,7 +237,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;" ] }, { diff --git a/planner/core/testdata/integration_serial_suite_out.json b/planner/core/testdata/integration_serial_suite_out.json index 3a7dc74884d6f..d1ce2e8ea8701 100644 --- a/planner/core/testdata/integration_serial_suite_out.json +++ b/planner/core/testdata/integration_serial_suite_out.json @@ -1525,58 +1525,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" ] }, @@ -1584,11 +1584,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" ] @@ -1597,8 +1597,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))", @@ -1609,8 +1609,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" @@ -1620,23 +1620,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" ] @@ -1660,6 +1660,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" + ] } ] }, @@ -1669,64 +1677,64 @@ { "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", + "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#7", + " └─HashAgg 1.00 batchCop[tiflash] funcs:count(1)->Column#8", " └─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", + "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#8", - " └─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#9)->Column#5", + "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#10)->Column#9", - " └─Projection 10000.00 batchCop[tiflash] plus(test.t.id, 1)->Column#10", + " └─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#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(1)->Column#8", + " └─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#9)->Column#5", + "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#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#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" ] }, @@ -1735,14 +1743,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" ] @@ -1752,10 +1760,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))", @@ -1767,10 +1775,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" @@ -1781,12 +1789,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" ] }, @@ -1795,14 +1803,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" ] @@ -1839,15 +1847,30 @@ "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] ", +<<<<<<< HEAD " └─ExchangeSender 8000.00 batchCop[tiflash] ExchangeType: HashPartition, Hash Cols: test.t.id", " └─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", +======= + " └─ExchangeSender 8000.00 batchCop[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.id, collate: N/A]", + " └─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", +>>>>>>> a18e05d2f... expression: limit valid decimal length (#28466) " └─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" + ] } ] },