// addSpecifiedData specializes the clause given the row provided and attempt to
// retrieve the corresponding clause data.
197592
func (p *queryPlan) addSpecifiedData(ctx context.Context, r table.Row, cls *semantic.GraphClause, lo *storage.LookupOptions) error {
	if cls.S == nil {
		v := getBoundValueForComponent(r, []string{cls.SBinding, cls.SAlias})
		if v != nil {
			if v.N != nil {
				cls.S = v.N
			}
		}
	}
	if cls.P == nil && cls.PID != "" && cls.PAnchorBinding != "" {
		v := r[cls.PAnchorBinding]
		if v != nil && v.T != nil {
			p, err := predicate.NewTemporal(cls.PID, *v.T)
			if err != nil {
				return err
			}
			cls.P = p
		}
	}
	if cls.P == nil {
		v := getBoundValueForComponent(r, []string{cls.PBinding, cls.PAlias})
		if v != nil {
			if v.P != nil {
				cls.P = v.P
			}
		}
		nlo, err := updateTimeBoundsForRow(lo, cls, r)
		if err != nil {
			return err
		}
		lo = nlo
	}
	if cls.O == nil && cls.OID != "" && cls.OAnchorBinding != "" {
		v := r[cls.OAnchorBinding]
		if v != nil && v.T != nil {
			p, err := predicate.NewTemporal(cls.OID, *v.T)
			if err != nil {
				return err
			}
			cls.O = triple.NewPredicateObject(p)
		}
	}
	if cls.O == nil {
		v := getBoundValueForComponent(r, []string{cls.OBinding, cls.OAlias})
		if v != nil {
			o, err := cellToObject(v)
			if err == nil {
				cls.O = o
			}
		}
		nlo, err := updateTimeBoundsForRow(lo, cls, r)
		if err != nil {
			return err
		}
		lo = nlo
	}

	tracer.Trace(p.tracer, func() []string {
		cls := *cls
		return []string{fmt.Sprintf("Corrected clause: %v", &cls)}
	})

	stmLimit := int64(0)
	if len(p.stm.GraphPatternClauses()) == 1 && len(p.stm.GroupBy()) == 0 && len(p.stm.HavingExpression()) == 0 {
		stmLimit = p.stm.Limit()
	}
	tbl, err := simpleFetch(ctx, p.grfs, cls, lo, stmLimit, p.chanSize, p.tracer)
	if err != nil {
		return err
	}
	p.tbl.AddBindings(tbl.Bindings())
	for _, nr := range tbl.Rows() {
		p.tbl.AddRow(table.MergeRows([]table.Row{r, nr}))
	}
	return nil
}
81583
func addToMetadata(md metadata.MD, key string, value string) error {
	if value == "" {
		return nil
	}
	if _, ok := md[key]; ok {
		return yarpcerrors.InvalidArgumentErrorf("duplicate key: %s", key)
	}
	md[key] = []string{value}
	return nil
}
442639
func (s *DescribeReservationOutput) SetResourceSpecification(v *ReservationResourceSpecification) *DescribeReservationOutput {
	s.ResourceSpecification = v
	return s
}
404305
func (s *Segment) AddBoolMetadata(key string, value bool) {
	s.addMetadata(key, value)
}
1288277
func (m *Microdata) addItem(item *Item) {
	m.Items = append(m.Items, item)
}
267817
func (s *DeployedImage) SetSpecifiedImage(v string) *DeployedImage {
	s.SpecifiedImage = &v
	return s
}
588480
func NewErrUnexpectedData(msg string, data []byte) error {
	return &ErrUnexpectedData{Msg: msg, Data: data}
}
382640
func (vm *VM) addAddCertificate() error {
	sc, err := vm.getServiceClient()
	if err != nil {
		return fmt.Errorf(errGetClient, err)
	}

	_, err = sc.AddCertificate(vm.Name, vm.Cert.Data, hostedservice.CertificateFormat(vm.Cert.Format), vm.SSHCreds.SSHPassword)
	return err
}
1333708
func AddDataFuncs(f map[string]interface{}, d *data.Data) {
	f["datasource"] = d.Datasource
	f["ds"] = d.Datasource
	f["datasourceExists"] = d.DatasourceExists
	f["datasourceReachable"] = d.DatasourceReachable
	f["defineDatasource"] = d.DefineDatasource
	f["include"] = d.Include

	f["data"] = DataNS

	f["json"] = DataNS().JSON
	f["jsonArray"] = DataNS().JSONArray
	f["yaml"] = DataNS().YAML
	f["yamlArray"] = DataNS().YAMLArray
	f["toml"] = DataNS().TOML
	f["csv"] = DataNS().CSV
	f["csvByRow"] = DataNS().CSVByRow
	f["csvByColumn"] = DataNS().CSVByColumn
	f["toJSON"] = DataNS().ToJSON
	f["toJSONPretty"] = DataNS().ToJSONPretty
	f["toYAML"] = DataNS().ToYAML
	f["toTOML"] = DataNS().ToTOML
	f["toCSV"] = DataNS().ToCSV
}
1234100
func (b *BatchBuilder) Add(builder Builder) *BatchBuilder {
	return b.AddStmt(builder.ToCql())
}
643508
func (s *Reservation) SetResourceSpecification(v *ReservationResourceSpecification) *Reservation {
	s.ResourceSpecification = v
	return s
}
921726
func (m *Manager) AddDataSource(data []byte, ct string) {
	src := &dataSource{
		Data: data,
		Type: ct,
	}
	m.AddSource(src)
}
874410
func (dec *Decoder) AddSQLNullFloat64(v *sql.NullFloat64) error {
	return dec.SQLNullFloat64(v)
}
753351
func (co *createOp) AddSelfUpdate(ptr data.BlockPointer) {
	co.AddUpdate(ptr, ptr)
}
583914
func (sc *StatementContext) AddAffectedRows(rows uint64) {
	sc.mu.Lock()
	sc.mu.affectedRows += rows
	sc.mu.Unlock()
}
175199
func (t *tableCommon) AddRecord(ctx sessionctx.Context, r []types.Datum, opts ...*table.AddRecordOpt) (recordID int64, err error) {
	opt := &table.AddRecordOpt{}
	if len(opts) != 0 {
		opt = opts[0]
	}
	var hasRecordID bool
	cols := t.Cols()
	// opt.IsUpdate is a flag for update.
	// If handle ID is changed when update, update will remove the old record first, and then call `AddRecord` to add a new record.
	// Currently, only insert can set _tidb_rowid, update can not update _tidb_rowid.
	if len(r) > len(cols) && !opt.IsUpdate {
		// The last value is _tidb_rowid.
		recordID = r[len(r)-1].GetInt64()
		hasRecordID = true
	} else {
		for _, col := range cols {
			if col.IsPKHandleColumn(t.meta) {
				recordID = r[col.Offset].GetInt64()
				hasRecordID = true
				break
			}
		}
	}
	if !hasRecordID {
		recordID, err = t.AllocAutoID(ctx)
		if err != nil {
			return 0, err
		}
	}

	txn, err := ctx.Txn(true)
	if err != nil {
		return 0, err
	}

	sessVars := ctx.GetSessionVars()

	rm, err := t.getRollbackableMemStore(ctx)
	// Insert new entries into indices.
	h, err := t.addIndices(ctx, recordID, r, rm, &opt.CreateIdxOpt)
	if err != nil {
		return h, err
	}

	var colIDs, binlogColIDs []int64
	var row, binlogRow []types.Datum
	colIDs = make([]int64, 0, len(r))
	row = make([]types.Datum, 0, len(r))

	for _, col := range t.WritableCols() {
		var value types.Datum
		// Update call `AddRecord` will already handle the write only column default value.
		// Only insert should add default value for write only column.
		if col.State != model.StatePublic && !opt.IsUpdate {
			// If col is in write only or write reorganization state, we must add it with its default value.
			value, err = table.GetColOriginDefaultValue(ctx, col.ToInfo())
			if err != nil {
				return 0, err
			}
			// add value to `r` for dirty db in transaction.
			// Otherwise when update will panic cause by get value of column in write only state from dirty db.
			if col.Offset < len(r) {
				r[col.Offset] = value
			} else {
				r = append(r, value)
			}
		} else {
			value = r[col.Offset]
		}
		if !t.canSkip(col, value) {
			colIDs = append(colIDs, col.ID)
			row = append(row, value)
		}
	}
	writeBufs := sessVars.GetWriteStmtBufs()
	adjustRowValuesBuf(writeBufs, len(row))
	key := t.RecordKey(recordID)
	writeBufs.RowValBuf, err = tablecodec.EncodeRow(ctx.GetSessionVars().StmtCtx, row, colIDs, writeBufs.RowValBuf, writeBufs.AddRowValues)
	if err != nil {
		return 0, err
	}
	value := writeBufs.RowValBuf
	if err = txn.Set(key, value); err != nil {
		return 0, err
	}
	txn.SetAssertion(key, kv.None)

	if !sessVars.LightningMode {
		if err = rm.(*kv.BufferStore).SaveTo(txn); err != nil {
			return 0, err
		}
	}

	if !ctx.GetSessionVars().LightningMode {
		ctx.StmtAddDirtyTableOP(table.DirtyTableAddRow, t.physicalTableID, recordID, r)
	}
	if shouldWriteBinlog(ctx) {
		// For insert, TiDB and Binlog can use same row and schema.
		binlogRow = row
		binlogColIDs = colIDs
		err = t.addInsertBinlog(ctx, recordID, binlogRow, binlogColIDs)
		if err != nil {
			return 0, err
		}
	}
	sessVars.StmtCtx.AddAffectedRows(1)
	colSize := make(map[int64]int64)
	for id, col := range t.Cols() {
		val := int64(len(r[id].GetBytes()))
		if val != 0 {
			colSize[col.ID] = val
		}
	}
	sessVars.TxnCtx.UpdateDeltaForTable(t.physicalTableID, 1, 1, colSize)
	return recordID, nil
}
486322
func (oc *OpCommon) AddSelfUpdate(ptr data.BlockPointer) {
	oc.AddUpdate(ptr, ptr)
}