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

Method ColumnIndex

pkg/expression/schema.go:164–181  ·  view source on GitHub ↗

ColumnIndex finds the index for a column.

(col *Column)

Source from the content-addressed store, hash-verified

162
163// ColumnIndex finds the index for a column.
164func (s *Schema) ColumnIndex(col *Column) int {
165 backupIdx := -1
166 for i, c := range s.Columns {
167 if c.UniqueID == col.UniqueID {
168 backupIdx = i
169 if c.IsPrefix {
170 // instead of returning a prefix column
171 // prefer to find a full column
172 // only clustered index table can meet this:
173 // same column `c1` maybe appear in both primary key and secondary index
174 // so secondary index itself can have two `c1` column one for indexKey and one for handle
175 continue
176 }
177 return i
178 }
179 }
180 return backupIdx
181}
182
183// Contains checks if the schema contains the column.
184func (s *Schema) Contains(col *Column) bool {

Callers 15

indexJoinPathTmpInitFunction · 0.95
GetMaxSortPrefixFunction · 0.95
RetrieveColumnMethod · 0.95
ContainsMethod · 0.95
ColumnsIndicesMethod · 0.95
buildExpandMethod · 0.80
coalesceCommonColumnsMethod · 0.80
buildProjectionFieldMethod · 0.80
buildProjectionMethod · 0.80
InjectProjBelowSortFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestSkylinePruningFunction · 0.64