diff --git a/pkg/planner/core/casetest/mpp/testdata/integration_suite_out.json b/pkg/planner/core/casetest/mpp/testdata/integration_suite_out.json index 0c339b9b06b6c..a75f09037a2ba 100644 --- a/pkg/planner/core/casetest/mpp/testdata/integration_suite_out.json +++ b/pkg/planner/core/casetest/mpp/testdata/integration_suite_out.json @@ -714,7 +714,7 @@ " │ └─TableFullScan 4.00 mpp[tiflash] table:d3_t pushed down filter:empty, keep order:false", " └─ExchangeReceiver(Probe) 64.00 mpp[tiflash] ", " └─ExchangeSender 64.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.fact_t.d3_k, collate: binary]", - " └─Projection 64.00 mpp[tiflash] test.fact_t.d3_k", + " └─Projection 64.00 mpp[tiflash] test.fact_t.d3_k, test.fact_t.d2_k", " └─HashJoin 64.00 mpp[tiflash] inner join, equal:[eq(test.fact_t.d2_k, test.d2_t.d2_k)]", " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.d2_t.d2_k, collate: binary]", @@ -722,7 +722,7 @@ " │ └─TableFullScan 4.00 mpp[tiflash] table:d2_t pushed down filter:empty, keep order:false", " └─ExchangeReceiver(Probe) 32.00 mpp[tiflash] ", " └─ExchangeSender 32.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.fact_t.d2_k, collate: binary]", - " └─Projection 32.00 mpp[tiflash] test.fact_t.d2_k, test.fact_t.d3_k", + " └─Projection 32.00 mpp[tiflash] test.fact_t.d2_k, test.fact_t.d3_k, test.fact_t.d1_k", " └─HashJoin 32.00 mpp[tiflash] inner join, equal:[eq(test.d1_t.d1_k, test.fact_t.d1_k)]", " ├─ExchangeReceiver(Build) 4.00 mpp[tiflash] ", " │ └─ExchangeSender 4.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.d1_t.d1_k, collate: binary]", @@ -1015,7 +1015,7 @@ "TableReader 1.00 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 1.00 mpp[tiflash] Column#13", - " └─Projection 1.00 mpp[tiflash] Column#13", + " └─Projection 1.00 mpp[tiflash] Column#13, Column#23, Column#24", " └─HashJoin 1.00 mpp[tiflash] left outer join, equal:[eq(test.t3.v1, test.t1.v1) eq(test.t3.v2, test.t1.v2)]", " ├─ExchangeReceiver(Build) 1.00 mpp[tiflash] ", " │ └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#23, collate: binary], [name: Column#24, collate: binary]", @@ -1045,7 +1045,7 @@ " └─ExchangeReceiver 2.00 mpp[tiflash] ", " └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t2.v1, collate: binary], [name: test.t2.v2, collate: binary]", " └─HashAgg 2.00 mpp[tiflash] group by:test.t2.v1, test.t2.v2, funcs:count(1)->Column#22", - " └─Projection 2.00 mpp[tiflash] test.t2.v1, test.t2.v2", + " └─Projection 2.00 mpp[tiflash] test.t2.v1, test.t2.v2, test.t1.v1, test.t1.v2", " └─HashJoin 2.00 mpp[tiflash] left outer join, equal:[eq(test.t1.v1, test.t2.v1) eq(test.t1.v2, test.t2.v2)]", " ├─ExchangeReceiver(Build) 2.00 mpp[tiflash] ", " │ └─ExchangeSender 2.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t1.v1, collate: binary], [name: test.t1.v2, collate: binary]", @@ -1066,7 +1066,7 @@ " └─HashAgg 1.00 mpp[tiflash] group by:test.t2.v1, test.t2.v2, funcs:count(1)->Column#9, funcs:firstrow(test.t2.v1)->test.t2.v1, funcs:firstrow(test.t2.v2)->test.t2.v2", " └─ExchangeReceiver 1.00 mpp[tiflash] ", " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t2.v1, collate: binary], [name: test.t2.v2, collate: binary]", - " └─Projection 1.00 mpp[tiflash] test.t2.v1, test.t2.v2", + " └─Projection 1.00 mpp[tiflash] test.t2.v1, test.t2.v2, test.t3.v1, test.t3.v2", " └─HashJoin 1.00 mpp[tiflash] left outer join, equal:[eq(test.t3.v1, test.t2.v1) eq(test.t3.v2, test.t2.v2)]", " ├─ExchangeReceiver(Build) 1.00 mpp[tiflash] ", " │ └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t3.v1, collate: binary], [name: test.t3.v2, collate: binary]", @@ -1593,7 +1593,7 @@ "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c1, test.t.c2, test.t.c3", - " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c1, test.t.c2, test.t.c3", + " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c1, test.t.c2, test.t.c3, Column#14, Column#16", " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(Column#13, Column#14) eq(Column#15, Column#16)]", " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#23, collate: binary], [name: Column#24, collate: binary]", @@ -1612,7 +1612,7 @@ "TableReader 7976.02 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 7976.02 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 7976.02 mpp[tiflash] test.t.c1, test.t.c2, test.t.c5, Column#7, test.t.c1, test.t.c2, test.t.c3, Column#14", - " └─Projection 7976.02 mpp[tiflash] Column#7, test.t.c1, test.t.c2, test.t.c5, Column#14, test.t.c1, test.t.c2, test.t.c3", + " └─Projection 7976.02 mpp[tiflash] Column#7, test.t.c1, test.t.c2, test.t.c5, Column#14, test.t.c1, test.t.c2, test.t.c3, Column#59, Column#60", " └─HashJoin 7976.02 mpp[tiflash] inner join, equal:[eq(test.t.c1, test.t.c2) eq(test.t.c2, test.t.c3) eq(test.t.c5, test.t.c1)]", " ├─ExchangeReceiver(Build) 7976.02 mpp[tiflash] ", " │ └─ExchangeSender 7976.02 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.c1, collate: binary], [name: Column#58, collate: binary], [name: test.t.c5, collate: binary]", @@ -1658,7 +1658,7 @@ "TableReader 12462.54 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 12462.54 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 12462.54 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5", - " └─Projection 12462.54 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5", + " └─Projection 12462.54 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, Column#19, Column#21, Column#22", " └─HashJoin 12462.54 mpp[tiflash] inner join, equal:[eq(test.t.c2, test.t.c1) eq(test.t.c3, test.t.c2) eq(test.t.c1, test.t.c3) eq(test.t.c3, test.t.c4) eq(test.t.c5, test.t.c1)]", " ├─ExchangeReceiver(Build) 9970.03 mpp[tiflash] ", " │ └─ExchangeSender 9970.03 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.t.c2, collate: binary], [name: Column#18, collate: binary], [name: Column#20, collate: binary], [name: test.t.c3, collate: binary], [name: test.t.c5, collate: binary]", @@ -1678,7 +1678,7 @@ "TableReader 12500.00 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 12500.00 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5", - " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5", + " └─Projection 12500.00 mpp[tiflash] test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, test.t.c1, test.t.c2, test.t.c3, test.t.c4, test.t.c5, Column#14", " └─HashJoin 12500.00 mpp[tiflash] inner join, equal:[eq(Column#13, Column#14)]", " ├─ExchangeReceiver(Build) 10000.00 mpp[tiflash] ", " │ └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#18, collate: binary]", diff --git a/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json b/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json index 4b106ec137efe..6ffc8c1fde96b 100644 --- a/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json +++ b/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json @@ -3088,7 +3088,7 @@ "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 8000.00 mpp[tiflash] Column#6, Column#5, test.employee.empid, test.employee.deptid, test.employee.salary", - " └─Projection 8000.00 mpp[tiflash] test.employee.empid, test.employee.deptid, test.employee.salary, Column#6, Column#5", + " └─Projection 8000.00 mpp[tiflash] test.employee.empid, test.employee.deptid, test.employee.salary, Column#6, Column#5, Column#26", " └─HashJoin 8000.00 mpp[tiflash] inner join, equal:[eq(test.employee.deptid, Column#6)]", " ├─ExchangeReceiver(Build) 6400.00 mpp[tiflash] ", " │ └─ExchangeSender 6400.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#6, collate: binary]", @@ -3114,7 +3114,7 @@ "TableReader 8000.00 root MppVersion: 2, data:ExchangeSender", "└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", " └─Projection 8000.00 mpp[tiflash] test.employee.empid, test.employee.deptid, test.employee.salary, Column#10, Column#9", - " └─Projection 8000.00 mpp[tiflash] test.employee.empid, test.employee.deptid, test.employee.salary, Column#10, Column#9", + " └─Projection 8000.00 mpp[tiflash] test.employee.empid, test.employee.deptid, test.employee.salary, Column#10, Column#9, Column#26", " └─HashJoin 8000.00 mpp[tiflash] inner join, equal:[eq(test.employee.deptid, Column#10)]", " ├─ExchangeReceiver(Build) 6400.00 mpp[tiflash] ", " │ └─ExchangeSender 6400.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#10, collate: binary]", diff --git a/pkg/planner/core/task.go b/pkg/planner/core/task.go index 19bc02024b877..36fae9b96ceba 100644 --- a/pkg/planner/core/task.go +++ b/pkg/planner/core/task.go @@ -447,6 +447,7 @@ func (p *PhysicalHashJoin) attach2TaskForMpp(tasks ...base.Task) base.Task { proj.SetSchema(p.Schema().Clone()) for _, hashCol := range hashColArray { if !proj.Schema().Contains(hashCol) { + proj.Exprs = append(proj.Exprs, hashCol) proj.Schema().Append(hashCol) } }