code: func BuildWindowFunctions(ctx sessionctx.Context, windowFuncDesc *aggregation.AggFuncDesc, ordinal int, orderByCols []*expression.Column) AggFunc {
  	switch windowFuncDesc.Name {
  	case ast.WindowFuncRank:
  		return buildRank(ordinal, orderByCols, false)
  	case ast.WindowFuncDenseRank:
  		return buildRank(ordinal, orderByCols, true)
  	case ast.WindowFuncRowNumber:
  		return buildRowNumber(windowFuncDesc, ordinal)
  	case ast.WindowFuncFirstValue:
  		return buildFirstValue(windowFuncDesc, ordinal)
  	case ast.WindowFuncLastValue:
  		return buildLastValue(windowFuncDesc, ordinal)
  	case ast.WindowFuncCumeDist:
  		return buildCumeDist(ordinal, orderByCols)
  	case ast.WindowFuncNthValue:
  		return buildNthValue(windowFuncDesc, ordinal)
  	case ast.WindowFuncNtile:
  		return buildNtile(windowFuncDesc, ordinal)
  	case ast.WindowFuncPercentRank:
  		return buildPercenRank(ordinal, orderByCols)
  	case ast.WindowFuncLead:
  		return buildLead(windowFuncDesc, ordinal)
  	case ast.WindowFuncLag:
  		return buildLag(windowFuncDesc, ordinal)
  	default:
  		return Build(ctx, windowFuncDesc, ordinal)
  	}
  }
docs: // BuildWindowFunctions builds specific window function according to function description and order by columns.