public static SqlAggFunction getCalciteAggFn(String hiveUdfName, boolean isDistinct,
      ImmutableList<RelDataType> calciteArgTypes, RelDataType calciteRetType) {
    SqlAggFunction calciteAggFn = (SqlAggFunction) hiveToCalcite.get(hiveUdfName);

    if (calciteAggFn == null) {
      CalciteUDFInfo udfInfo = getUDFInfo(hiveUdfName, calciteArgTypes, calciteRetType);

      switch (hiveUdfName.toLowerCase()) {
      case "sum":
        calciteAggFn = new HiveSqlSumAggFunction(
            isDistinct,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "$sum0":
        calciteAggFn = new HiveSqlSumEmptyIsZeroAggFunction(
            isDistinct,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "count":
        calciteAggFn = new HiveSqlCountAggFunction(
            isDistinct,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "min":
        calciteAggFn = new HiveSqlMinMaxAggFunction(
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker, true);
        break;
      case "max":
        calciteAggFn = new HiveSqlMinMaxAggFunction(
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker, false);
        break;
      case "avg":
        calciteAggFn = new HiveSqlAverageAggFunction(
            isDistinct,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "std":
      case "stddev":
      case "stddev_pop":
        calciteAggFn = new HiveSqlVarianceAggFunction(
            "stddev_pop",
            SqlKind.STDDEV_POP,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "stddev_samp":
        calciteAggFn = new HiveSqlVarianceAggFunction(
            "stddev_samp",
            SqlKind.STDDEV_SAMP,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "variance":
      case "var_pop":
        calciteAggFn = new HiveSqlVarianceAggFunction(
            "var_pop",
            SqlKind.VAR_POP,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      case "var_samp":
        calciteAggFn = new HiveSqlVarianceAggFunction(
            "var_samp",
            SqlKind.VAR_SAMP,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      default:
        calciteAggFn = new CalciteUDAF(
            isDistinct,
            udfInfo.udfName,
            udfInfo.returnTypeInference,
            udfInfo.operandTypeInference,
            udfInfo.operandTypeChecker);
        break;
      }
    }
    return calciteAggFn;
  }
This class is used to build immutable hashmaps in the static block above.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java