planner: implement BuildKeyInfo of LogicalTopN and LogicalTableDual (#15543)
This commit is contained in:
@ -111,6 +111,22 @@ func (p *LogicalLimit) BuildKeyInfo(selfSchema *expression.Schema, childSchema [
|
||||
}
|
||||
}
|
||||
|
||||
// BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
|
||||
func (p *LogicalTopN) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema) {
|
||||
p.baseLogicalPlan.BuildKeyInfo(selfSchema, childSchema)
|
||||
if p.Count == 1 {
|
||||
p.maxOneRow = true
|
||||
}
|
||||
}
|
||||
|
||||
// BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
|
||||
func (p *LogicalTableDual) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema) {
|
||||
p.baseLogicalPlan.BuildKeyInfo(selfSchema, childSchema)
|
||||
if p.RowCount == 1 {
|
||||
p.maxOneRow = true
|
||||
}
|
||||
}
|
||||
|
||||
// A bijection exists between columns of a projection's schema and this projection's Exprs.
|
||||
// Sometimes we need a schema made by expr of Exprs to convert a column in child's schema to a column in this projection's Schema.
|
||||
func (p *LogicalProjection) buildSchemaByExprs(selfSchema *expression.Schema) *expression.Schema {
|
||||
|
||||
@ -169,7 +169,7 @@
|
||||
"Err": false
|
||||
},
|
||||
{
|
||||
"Best": "Apply{UnionAll{UnionAll{Dual->Projection->Dual->Projection}->Aggr(firstrow(Column#4))->Projection->Dual->Projection}->Dual->Projection->MaxOneRow}->Sort->Projection",
|
||||
"Best": "Join{UnionAll{UnionAll{Dual->Projection->Dual->Projection}->Aggr(firstrow(Column#4))->Projection->Dual->Projection}->Dual}->Sort->Projection",
|
||||
"Err": false
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user