code: func (a *baseFuncDesc) typeInfer(ctx sessionctx.Context) {
  	switch a.Name {
  	case ast.AggFuncCount:
  		a.typeInfer4Count(ctx)
  	case ast.AggFuncSum:
  		a.typeInfer4Sum(ctx)
  	case ast.AggFuncAvg:
  		a.typeInfer4Avg(ctx)
  	case ast.AggFuncGroupConcat:
  		a.typeInfer4GroupConcat(ctx)
  	case ast.AggFuncMax, ast.AggFuncMin, ast.AggFuncFirstRow,
  		ast.WindowFuncFirstValue, ast.WindowFuncLastValue, ast.WindowFuncNthValue:
  		a.typeInfer4MaxMin(ctx)
  	case ast.AggFuncBitAnd, ast.AggFuncBitOr, ast.AggFuncBitXor:
  		a.typeInfer4BitFuncs(ctx)
  	case ast.WindowFuncRowNumber, ast.WindowFuncRank, ast.WindowFuncDenseRank:
  		a.typeInfer4NumberFuncs()
  	case ast.WindowFuncCumeDist:
  		a.typeInfer4CumeDist()
  	case ast.WindowFuncNtile:
  		a.typeInfer4Ntile()
  	case ast.WindowFuncPercentRank:
  		a.typeInfer4PercentRank()
  	case ast.WindowFuncLead, ast.WindowFuncLag:
  		a.typeInfer4LeadLag(ctx)
  	default:
  		panic("unsupported agg function: " + a.Name)
  	}
  }
docs: // typeInfer infers the arguments and return types of an function.