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

Function buildHandleColsForSplit

pkg/executor/builder.go:2714–2733  ·  view source on GitHub ↗
(tbInfo *model.TableInfo)

Source from the content-addressed store, hash-verified

2712}
2713
2714func buildHandleColsForSplit(tbInfo *model.TableInfo) plannerutil.HandleCols {
2715 if tbInfo.IsCommonHandle {
2716 primaryIdx := tables.FindPrimaryIndex(tbInfo)
2717 tableCols := make([]*expression.Column, len(tbInfo.Columns))
2718 for i, col := range tbInfo.Columns {
2719 tableCols[i] = &expression.Column{
2720 ID: col.ID,
2721 RetType: &col.FieldType,
2722 }
2723 }
2724 for i, pkCol := range primaryIdx.Columns {
2725 tableCols[pkCol.Offset].Index = i
2726 }
2727 return plannerutil.NewCommonHandleCols(tbInfo, primaryIdx, tableCols)
2728 }
2729 intCol := &expression.Column{
2730 RetType: types.NewFieldType(mysql.TypeLonglong),
2731 }
2732 return plannerutil.NewIntHandleCols(intCol)
2733}
2734
2735func (b *executorBuilder) buildDistributeTable(v *plannercore.DistributeTable) exec.Executor {
2736 base := exec.NewBaseExecutor(b.ctx, v.Schema(), v.ID())

Callers 2

buildSplitRegionMethod · 0.85

Calls 2

FindPrimaryIndexFunction · 0.92
NewFieldTypeFunction · 0.92

Tested by 1