code: func (cf *countFunction) Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) error {
  	var datumBuf []types.Datum
  	if cf.HasDistinct {
  		datumBuf = make([]types.Datum, 0, len(cf.Args))
  	}
  	for _, a := range cf.Args {
  		value, err := a.Eval(row)
  		if err != nil {
  			return err
  		}
  		if value.IsNull() {
  			return nil
  		}
  		if cf.Mode == FinalMode || cf.Mode == Partial2Mode {
  			evalCtx.Count += value.GetInt64()
  		}
  		if cf.HasDistinct {
  			datumBuf = append(datumBuf, value)
  		}
  	}
  	if cf.HasDistinct {
  		d, err := evalCtx.DistinctChecker.Check(datumBuf)
  		if err != nil {
  			return err
  		}
  		if !d {
  			return nil
  		}
  	}
  	if cf.Mode == CompleteMode || cf.Mode == Partial1Mode {
  		evalCtx.Count++
  	}
  	return nil
  }
docs: // Update implements Aggregation interface.