// SupplyCol satisfies the builder interface.
323527
func (vf *vindexFunc) SupplyCol(col *sqlparser.ColName) (rc *resultColumn, colnum int) {
	c := col.Metadata.(*column)
	for i, rc := range vf.resultColumns {
		if rc.column == c {
			return rc, i
		}
	}

	vf.resultColumns = append(vf.resultColumns, &resultColumn{column: c})
	vf.eVindexFunc.Fields = append(vf.eVindexFunc.Fields, &querypb.Field{
		Name: col.Name.String(),
		Type: querypb.Type_VARBINARY,
	})

	// columns that reference vindexFunc will have their colnum set.
	// Let's use it here.
	vf.eVindexFunc.Cols = append(vf.eVindexFunc.Cols, c.colnum)
	return rc, len(vf.resultColumns) - 1
}
532758
func (x *SupplyDelivery) UnmarshalJSON(data []byte) (err error) {
	x2 := supplyDelivery{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = SupplyDelivery(x2)
		return x.checkResourceType()
	}
	return
}
1359722
func (r *Redshift) UpdateTable(tx *sql.Tx, inputTable, targetTable Table) error {

	columnOps, err := checkSchemas(inputTable, targetTable)
	if err != nil {
		return fmt.Errorf("mismatched schema: %s", err)
	}

	// postgres only allows adding one column at a time
	for _, op := range columnOps {
		alterStmt, err := tx.PrepareContext(r.ctx, op)
		if err != nil {
			return fmt.Errorf("issue preparing statement: '%s' - err: %s", op, err)
		}

		log.Printf("Running command: %s", op)
		_, err = alterStmt.ExecContext(r.ctx)
		if err != nil {
			return fmt.Errorf("issue running statement %s: %s", op, err)
		}
	}
	return nil
}
188855
func EqLit(column, literal string) Cmp {
	return Cmp{
		op:     eq,
		column: column,
		value:  lit(literal),
	}
}
135787
func (resource *SupplyDelivery) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "SupplyDelivery"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to SupplyDelivery), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
48572
func (d *Document) CursorPositionCol() (col int) {
	// Don't use self.text_before_cursor to calculate this. Creating substrings
	// and splitting is too expensive for getting the cursor position.
	_, index := d.findLineStartIndex(d.cursorPosition)
	col = d.cursorPosition - index
	return
}
1042303
func (s *propOuterJoinConstSolver) pickEQCondsOnOuterCol(retMapper map[int]*Constant, visited []bool, filterConds bool) map[int]*Constant {
	var conds []Expression
	var condsOffset int
	if filterConds {
		conds = s.filterConds
	} else {
		conds = s.joinConds
		condsOffset = len(s.filterConds)
	}
	for i, cond := range conds {
		if visited[i+condsOffset] {
			continue
		}
		col, con := validEqualCond(cond)
		// Then we check if this CNF item is a false constant. If so, we will set the whole condition to false.
		var ok bool
		if col == nil {
			if con, ok = cond.(*Constant); ok {
				value, _, err := EvalBool(s.ctx, []Expression{con}, chunk.Row{})
				if err != nil {
					terror.Log(err)
					return nil
				}
				if !value {
					s.setConds2ConstFalse(filterConds)
					return nil
				}
			}
			continue
		}
		// Only extract `outerCol = const` expressions.
		if !s.outerSchema.Contains(col) {
			continue
		}
		visited[i+condsOffset] = true
		updated, foreverFalse := s.tryToUpdateEQList(col, con)
		if foreverFalse {
			s.setConds2ConstFalse(filterConds)
			return nil
		}
		if updated {
			retMapper[s.getColID(col)] = con
		}
	}
	return retMapper
}
299584
func (ppl *Pipeline) ensureProtocol() error {
	if ppl.resp == nil {
		p, err := ppl.database.pool.pull(unforcedPull)
		if err != nil {
			return err
		}
		ppl.resp = p
		ppl.counter = 0
	}
	return nil
}
383969
func getPrintCol(c col) *color.Color {
	switch c {
	case colGrey:
		return color.New(color.FgWhite, color.Bold)
	case colRed:
		return color.New(color.FgRed, color.Bold)
	case colYellow:
		return color.New(color.FgYellow, color.Bold)
	case colGreen:
		return color.New(color.FgGreen, color.Bold)
	}
	return nil
}
1210096
func (x *SupplyRequest) UnmarshalJSON(data []byte) (err error) {
	x2 := supplyRequest{}
	if err = json.Unmarshal(data, &x2); err == nil {
		if x2.Contained != nil {
			for i := range x2.Contained {
				x2.Contained[i] = MapToResource(x2.Contained[i], true)
			}
		}
		*x = SupplyRequest(x2)
		return x.checkResourceType()
	}
	return
}
1280403
func (rb *route) BuildColName(index int) (*sqlparser.ColName, error) {
	alias := rb.resultColumns[index].alias
	if alias.IsEmpty() {
		return nil, errors.New("cannot reference a complex expression")
	}
	for i, rc := range rb.resultColumns {
		if i == index {
			continue
		}
		if rc.alias.Equal(alias) {
			return nil, fmt.Errorf("ambiguous symbol reference: %v", alias)
		}
	}
	return &sqlparser.ColName{
		Metadata: rb.resultColumns[index].column,
		Name:     alias,
	}, nil
}
18313
func (rc *ReadinessCheck) SetProtocol(proto string) *ReadinessCheck {
	rc.Protocol = proto
	return rc
}
645715
func (s *AddOutputRequest) SetProtocol(v string) *AddOutputRequest {
	s.Protocol = &v
	return s
}
378538
func In(column string) Cmp {
	return Cmp{
		op:     in,
		column: column,
		value:  param(column),
	}
}
1030306
func (s *Listener) SetProtocol(v string) *Listener {
	s.Protocol = &v
	return s
}
203095
func Eq(column string) Cmp {
	return Cmp{
		op:     eq,
		column: column,
		value:  param(column),
	}
}
1183523
func indexCol2Col(cols []*Column, col *model.IndexColumn) *Column {
	for _, c := range cols {
		if c.ColName.L == col.Name.L {
			return c
		}
	}
	return nil
}