code: func hasSpecialCast(ctx sessionctx.Context, expr Expression, tp *types.FieldType) bool {
  	switch f := expr.(type) {
  	case *ScalarFunction:
  		switch f.FuncName.L {
  		case ast.DayName:
  			switch tp.EvalType() {
  			case types.ETInt, types.ETReal:
  				return true
  			}
  		}
  	}
  	return false
  }
docs: // hasSpecialCast checks if this expr has its own special cast function.
  // for example(#9713): when doing arithmetic using results of function DayName,
  // "Monday" should be regarded as 0, "Tuesday" should be regarded as 1 and so on.