code: func builtinSpace(args []types.Datum, ctx context.Context) (d types.Datum, err error) {
  	x := args[0]
  	if x.IsNull() {
  		return d, nil
  	}
  	sc := ctx.GetSessionVars().StmtCtx
  	if x.Kind() == types.KindString || x.Kind() == types.KindBytes {
  		if _, e := types.StrToInt(sc, x.GetString()); e != nil {
  			return d, errors.Trace(e)
  		}
  	}
  
  	v, err := x.ToInt64(ctx.GetSessionVars().StmtCtx)
  	if err != nil {
  		return d, errors.Trace(err)
  	}
  
  	if v < 0 {
  		v = 0
  	}
  
  	if v > math.MaxInt32 {
  		d.SetNull()
  	} else {
  		d.SetString(strings.Repeat(" ", int(v)))
  	}
  	return d, nil
  }
docs: // See http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_space