Skip to content

Commit c27a5b0

Browse files
authored
Merge pull request #3150 from dolthub/angela/animals
Misc code clean up
2 parents a2ed59d + c10f948 commit c27a5b0

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
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: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ func (m *Memo) optimizeMemoGroup(grp *ExprGroup) error {
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)