MCPcopy
hub / github.com/pingcap/tidb / buildHandleColsForExec

Function buildHandleColsForExec

pkg/executor/builder.go:633–659  ·  view source on GitHub ↗
(tblInfo *model.TableInfo, allColInfo []*model.ColumnInfo)

Source from the content-addressed store, hash-verified

631}
632
633func buildHandleColsForExec(tblInfo *model.TableInfo, allColInfo []*model.ColumnInfo) plannerutil.HandleCols {
634 if !tblInfo.IsCommonHandle {
635 extraColPos := len(allColInfo) - 1
636 intCol := &expression.Column{
637 Index: extraColPos,
638 RetType: types.NewFieldType(mysql.TypeLonglong),
639 }
640 return plannerutil.NewIntHandleCols(intCol)
641 }
642 tblCols := make([]*expression.Column, len(tblInfo.Columns))
643 for i := 0; i < len(tblInfo.Columns); i++ {
644 c := tblInfo.Columns[i]
645 tblCols[i] = &expression.Column{
646 RetType: &c.FieldType,
647 ID: c.ID,
648 }
649 }
650 pkIdx := tables.FindPrimaryIndex(tblInfo)
651 for _, c := range pkIdx.Columns {
652 for j, colInfo := range allColInfo {
653 if colInfo.Name.L == c.Name.L {
654 tblCols[c.Offset].Index = j
655 }
656 }
657 }
658 return plannerutil.NewCommonHandleCols(tblInfo, pkIdx, tblCols)
659}
660
661func (b *executorBuilder) buildCleanupIndex(v *plannercore.CleanupIndex) exec.Executor {
662 tblInfo := v.Table.TableInfo

Callers 2

buildRecoverIndexMethod · 0.85
buildCleanupIndexMethod · 0.85

Calls 2

NewFieldTypeFunction · 0.92
FindPrimaryIndexFunction · 0.92

Tested by

no test coverage detected