code: func buildMaxMin(aggFuncDesc *aggregation.AggFuncDesc, ordinal int, isMax bool) AggFunc {
  	base := baseMaxMinAggFunc{
  		baseAggFunc: baseAggFunc{
  			args:    aggFuncDesc.Args,
  			ordinal: ordinal,
  		},
  		isMax: isMax,
  	}
  
  	evalType, fieldType := aggFuncDesc.RetTp.EvalType(), aggFuncDesc.RetTp
  	if fieldType.Tp == mysql.TypeBit {
  		evalType = types.ETString
  	}
  	switch aggFuncDesc.Mode {
  	case aggregation.DedupMode:
  	default:
  		switch evalType {
  		case types.ETInt:
  			if mysql.HasUnsignedFlag(fieldType.Flag) {
  				return &maxMin4Uint{base}
  			}
  			return &maxMin4Int{base}
  		case types.ETReal:
  			switch fieldType.Tp {
  			case mysql.TypeFloat:
  				return &maxMin4Float32{base}
  			case mysql.TypeDouble:
  				return &maxMin4Float64{base}
  			}
  		case types.ETDecimal:
  			return &maxMin4Decimal{base}
  		case types.ETString:
  			return &maxMin4String{base}
  		case types.ETDatetime, types.ETTimestamp:
  			return &maxMin4Time{base}
  		case types.ETDuration:
  			return &maxMin4Duration{base}
  		case types.ETJson:
  			return &maxMin4JSON{base}
  		}
  	}
  	return nil
  }
docs: // buildMaxMin builds the AggFunc implementation for function "MAX" and "MIN".