(v *plannercore.CleanupIndex)
| 659 | } |
| 660 | |
| 661 | func (b *executorBuilder) buildCleanupIndex(v *plannercore.CleanupIndex) exec.Executor { |
| 662 | tblInfo := v.Table.TableInfo |
| 663 | t, err := b.is.TableByName(context.Background(), v.Table.Schema, tblInfo.Name) |
| 664 | if err != nil { |
| 665 | b.err = err |
| 666 | return nil |
| 667 | } |
| 668 | idxName := strings.ToLower(v.IndexName) |
| 669 | var index table.Index |
| 670 | for _, idx := range t.Indices() { |
| 671 | if idx.Meta().State != model.StatePublic { |
| 672 | continue |
| 673 | } |
| 674 | if idxName == idx.Meta().Name.L { |
| 675 | index = idx |
| 676 | break |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | if index == nil { |
| 681 | b.err = errors.Errorf("secondary index `%v` is not found in table `%v`", v.IndexName, v.Table.Name.O) |
| 682 | return nil |
| 683 | } |
| 684 | if index.Meta().VectorInfo != nil { |
| 685 | b.err = errors.Errorf("vector index `%v` is not supported for cleanup index", v.IndexName) |
| 686 | return nil |
| 687 | } |
| 688 | e := &CleanupIndexExec{ |
| 689 | BaseExecutor: exec.NewBaseExecutor(b.ctx, v.Schema(), v.ID()), |
| 690 | columns: buildIdxColsConcatHandleCols(tblInfo, index.Meta(), false), |
| 691 | index: index, |
| 692 | table: t, |
| 693 | physicalID: t.Meta().ID, |
| 694 | batchSize: 20000, |
| 695 | } |
| 696 | e.handleCols = buildHandleColsForExec(tblInfo, e.columns) |
| 697 | if e.index.Meta().Global { |
| 698 | e.columns = append(e.columns, model.NewExtraPhysTblIDColInfo()) |
| 699 | } |
| 700 | return e |
| 701 | } |
| 702 | |
| 703 | func (b *executorBuilder) buildCheckIndexRange(v *plannercore.CheckIndexRange) exec.Executor { |
| 704 | tb, err := b.is.TableByName(context.Background(), v.Table.Schema, v.Table.Name) |
no test coverage detected