Skip to content

Commit 5804185

Browse files
committed
misc code clean up
1 parent 466cdf1 commit 5804185

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

sql/analyzer/costed_index_scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func (c *indexCoster) updateBest(s sql.Statistic, hist []sql.HistogramBucket, fd
617617
{
618618
// if no unique keys, prefer equality over ranges
619619
bestConst, bestIsNull := c.getConstAndNullFilters(c.bestFilters)
620-
cmpConst, cmpIsNull := c.getConstAndNullFilters(c.bestFilters)
620+
cmpConst, cmpIsNull := c.getConstAndNullFilters(filters)
621621
if cmpConst.Len() > bestConst.Len() {
622622
update = true
623623
return

sql/memo/memo.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,13 @@ func (m *Memo) OptimizeRoot() error {
400400
// the same subgroup dependencies. After finding the best implementation
401401
// for a particular group, we fix the best plan for that group and recurse
402402
// into its parents.
403-
// TODO: we should not have to cost every plan, sometimes there is a provably
403+
// TODO: we should not have to cost every plan, sometimes there is a probably
404404
// best case implementation
405405
func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
406406
if grp.Done {
407407
return nil
408408
}
409409

410-
var err error
411410
n := grp.First
412411
if _, ok := n.(SourceRel); ok {
413412
// We should order the search bottom-up so that physical operators
@@ -425,7 +424,7 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
425424
for n != nil {
426425
var cost float64
427426
for _, g := range n.Children() {
428-
err = m.optimizeMemoGroup(g)
427+
err := m.optimizeMemoGroup(g)
429428
if err != nil {
430429
return err
431430
}
@@ -437,15 +436,13 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
437436
}
438437

439438
if grp.RelProps.Distinct.IsHash() {
440-
var dCost float64
441439
if sortedInputs(n) {
442440
n.SetDistinct(SortedDistinctOp)
443441
} else {
444442
n.SetDistinct(HashDistinctOp)
445443
d := &Distinct{Child: grp}
446-
dCost = float64(statsForRel(m.Ctx, d).RowCount())
444+
relCost += float64(statsForRel(m.Ctx, d).RowCount())
447445
}
448-
relCost += dCost
449446
} else {
450447
n.SetDistinct(NoDistinctOp)
451448
}
@@ -457,9 +454,6 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
457454
}
458455

459456
grp.Done = true
460-
if err != nil {
461-
return err
462-
}
463457
return nil
464458
}
465459

sql/rowexec/ddl_iters.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,9 +2366,6 @@ func (b *BaseBuilder) executeAlterAutoInc(ctx *sql.Context, n *plan.AlterAutoInc
23662366
if !ok {
23672367
return plan.ErrInsertIntoNotSupported.New()
23682368
}
2369-
if err != nil {
2370-
return err
2371-
}
23722369

23732370
autoTbl, ok := insertable.(sql.AutoIncrementTable)
23742371
if !ok {

0 commit comments

Comments
 (0)