code: func (c *strToDateFunctionClass) getFunction(ctx sessionctx.Context, args []Expression) (sig builtinFunc, err error) {
  	if err := c.verifyArgs(args); err != nil {
  		return nil, err
  	}
  	retTp, fsp := c.getRetTp(ctx, args[1])
  	switch retTp {
  	case mysql.TypeDate:
  		bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETDatetime, types.ETString, types.ETString)
  		bf.tp.Tp, bf.tp.Flen, bf.tp.Decimal = mysql.TypeDate, mysql.MaxDateWidth, types.MinFsp
  		sig = &builtinStrToDateDateSig{bf}
  	case mysql.TypeDatetime:
  		bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETDatetime, types.ETString, types.ETString)
  		if fsp == types.MinFsp {
  			bf.tp.Flen, bf.tp.Decimal = mysql.MaxDatetimeWidthNoFsp, types.MinFsp
  		} else {
  			bf.tp.Flen, bf.tp.Decimal = mysql.MaxDatetimeWidthWithFsp, types.MaxFsp
  		}
  		sig = &builtinStrToDateDatetimeSig{bf}
  	case mysql.TypeDuration:
  		bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETDuration, types.ETString, types.ETString)
  		if fsp == types.MinFsp {
  			bf.tp.Flen, bf.tp.Decimal = mysql.MaxDurationWidthNoFsp, types.MinFsp
  		} else {
  			bf.tp.Flen, bf.tp.Decimal = mysql.MaxDurationWidthWithFsp, types.MaxFsp
  		}
  		sig = &builtinStrToDateDurationSig{bf}
  	}
  	return sig, nil
  }
docs: // getFunction see https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date