code: func checkPartitionFuncType(ctx sessionctx.Context, s *ast.CreateTableStmt, cols []*table.Column, tblInfo *model.TableInfo) error {
  	if s.Partition.Expr == nil {
  		return nil
  	}
  	buf := new(bytes.Buffer)
  	s.Partition.Expr.Format(buf)
  	exprStr := buf.String()
  	if s.Partition.Tp == model.PartitionTypeRange {
  		// if partition by columnExpr, check the column type
  		if _, ok := s.Partition.Expr.(*ast.ColumnNameExpr); ok {
  			for _, col := range cols {
  				name := strings.Replace(col.Name.String(), ".", "`.`", -1)
  				// Range partitioning key supported types: tinyint, smallint, mediumint, int and bigint.
  				if !validRangePartitionType(col) && fmt.Sprintf("`%s`", name) == exprStr {
  					return errors.Trace(ErrNotAllowedTypeInPartition.GenWithStackByArgs(exprStr))
  				}
  			}
  		}
  	}
  
  	e, err := expression.ParseSimpleExprWithTableInfo(ctx, buf.String(), tblInfo)
  	if err != nil {
  		return errors.Trace(err)
  	}
  	if e.GetType().EvalType() == types.ETInt {
  		return nil
  	}
  	return ErrPartitionFuncNotAllowed.GenWithStackByArgs("PARTITION")
  }
docs: // checkPartitionFuncType checks partition function return type.