Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Jul 20, 2021
1 parent 265991a commit 2c06431
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions planner/core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,52 +1088,3 @@ func (p *LogicalWindow) ExtractColGroups(colGroups [][]*expression.Column) [][]*
}
return extracted
}
<<<<<<< HEAD
=======

// DeriveStats implement LogicalPlan DeriveStats interface.
func (p *LogicalCTE) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*property.StatsInfo, error) {
if p.stats != nil {
return p.stats, nil
}

var err error
p.cte.seedPartPhysicalPlan, _, err = DoOptimize(context.TODO(), p.ctx, p.cte.optFlag, p.cte.seedPartLogicalPlan)
if err != nil {
return nil, err
}
resStat := p.cte.seedPartPhysicalPlan.Stats()
p.stats = &property.StatsInfo{
RowCount: resStat.RowCount,
ColNDVs: make(map[int64]float64, selfSchema.Len()),
}
for i, col := range selfSchema.Columns {
p.stats.ColNDVs[col.UniqueID] += resStat.ColNDVs[p.cte.seedPartLogicalPlan.Schema().Columns[i].UniqueID]
}
if p.cte.recursivePartLogicalPlan != nil {
p.cte.recursivePartPhysicalPlan, _, err = DoOptimize(context.TODO(), p.ctx, p.cte.optFlag, p.cte.recursivePartLogicalPlan)
if err != nil {
return nil, err
}
recurStat := p.cte.recursivePartPhysicalPlan.Stats()
for i, col := range selfSchema.Columns {
p.stats.ColNDVs[col.UniqueID] += recurStat.ColNDVs[p.cte.recursivePartLogicalPlan.Schema().Columns[i].UniqueID]
}
if p.cte.IsDistinct {
p.stats.RowCount = getColsNDV(p.schema.Columns, p.schema, p.stats)
} else {
p.stats.RowCount += recurStat.RowCount
}
}
return p.stats, nil
}

// DeriveStats implement LogicalPlan DeriveStats interface.
func (p *LogicalCTETable) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*property.StatsInfo, error) {
if p.stats != nil {
return p.stats, nil
}
p.stats = p.seedPlan.statsInfo()
return p.stats, nil
}
>>>>>>> 0bf495d5e... planner: unify the terms NDV and cardinality in the optimizer (#26345)

0 comments on commit 2c06431

Please sign in to comment.