Skip to content

Commit cfeaf56

Browse files
time-and-fateti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#51329
Signed-off-by: ti-chi-bot <[email protected]>
1 parent 9220d94 commit cfeaf56

File tree

4 files changed

+2536
-0
lines changed

4 files changed

+2536
-0
lines changed

planner/core/logical_plans.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,9 +1140,13 @@ type LogicalMaxOneRow struct {
11401140
}
11411141

11421142
// LogicalTableDual represents a dual table plan.
1143+
// Note that sometimes we don't set schema for LogicalTableDual (most notably in buildTableDual()), which means
1144+
// outputting 0/1 row with zero column. This semantic may be different from your expectation sometimes but should not
1145+
// cause any actual problems now.
11431146
type LogicalTableDual struct {
11441147
logicalSchemaProducer
11451148

1149+
// RowCount could only be 0 or 1.
11461150
RowCount int
11471151
}
11481152

planner/core/rule_predicate_push_down.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,15 @@ func (p *LogicalProjection) PredicatePushDown(predicates []expression.Expression
505505
return predicates, child
506506
}
507507
}
508+
<<<<<<< HEAD:planner/core/rule_predicate_push_down.go
508509
if len(p.children) == 1 {
509510
if _, isDual := p.children[0].(*LogicalTableDual); isDual {
510511
return predicates, p
511512
}
512513
}
514+
=======
515+
exprCtx := p.SCtx().GetExprCtx()
516+
>>>>>>> 27ce02afd2e (planner: remove the limitation that predicates can't be pushed through `Projection` on `TableDual` (#51329)):pkg/planner/core/rule_predicate_push_down.go
513517
for _, cond := range predicates {
514518
substituted, hasFailed, newFilter := expression.ColumnSubstituteImpl(cond, p.Schema(), p.Exprs, true)
515519
if substituted && !hasFailed && !expression.HasGetSetVarFunc(newFilter) {

0 commit comments

Comments
 (0)