public static Function<List<ExprNodeDesc>, ExprNodeDesc> getCustomSortExprs(TransformSpec spec, int index) {
    switch (spec.getTransformType()) {
      case BUCKET:
        return BUCKET_SORT_EXPR.apply(index, spec.getTransformParam().get());
      case TRUNCATE:
        return TRUNCATE_SORT_EXPR.apply(index, spec.getTransformParam().get());
      case YEAR:
        return YEAR_SORT_EXPR.apply(index);
      case MONTH:
        return MONTH_SORT_EXPR.apply(index);
      case DAY:
        return DAY_SORT_EXPR.apply(index);
      case HOUR:
        return HOUR_SORT_EXPR.apply(index);
      default:
        return cols -> cols.get(index).clone();
    }
  }
Function template for producing a custom sort expression function:
Takes the source column index and the bucket count to create a function where Iceberg transform UDF is used to
build the sort expression, e.g. iceberg_bucket(_col2, 5)
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTransformSortFunctionUtil.java