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

Method getRow

pkg/executor/importer/kv_encode.go:166–179  ·  view source on GitHub ↗

getRow gets the row which from `insert into select from` or `load data`. The input values from these two statements are datums instead of expressions which are used in `insert into set x=y`. copied from InsertValues

(vals []types.Datum, hasValue []bool, rowID int64)

Source from the content-addressed store, hash-verified

164// expressions which are used in `insert into set x=y`.
165// copied from InsertValues
166func (en *TableKVEncoder) getRow(vals []types.Datum, hasValue []bool, rowID int64) ([]types.Datum, error) {
167 row := make([]types.Datum, len(en.Columns))
168 for i := range en.insertColumns {
169 casted, err := table.CastColumnValue(en.SessionCtx.GetExprCtx(), vals[i], en.insertColumns[i].ToInfo(), false, false)
170 if err != nil {
171 return nil, err
172 }
173
174 offset := en.insertColumns[i].Offset
175 row[offset] = casted
176 }
177
178 return en.fillRow(row, hasValue, rowID)
179}
180
181func (en *TableKVEncoder) fillRow(row []types.Datum, hasValue []bool, rowID int64) ([]types.Datum, error) {
182 var value types.Datum

Callers 1

parserData2TableDataMethod · 0.95

Calls 4

fillRowMethod · 0.95
CastColumnValueFunction · 0.92
GetExprCtxMethod · 0.65
ToInfoMethod · 0.45

Tested by

no test coverage detected