public static <T> Global<T> globally() {
    return new Global<>();
  }
@Test
  @Category(NeedsRunner.class)
  public void testAggregateLogicalValuesGlobally() {
    Collection<BasicEnum> elements =
        Lists.newArrayList(
            BasicEnum.of("a", BasicEnum.TestEnum.ONE), BasicEnum.of("a", BasicEnum.TestEnum.TWO));

    CombineFn<EnumerationType.Value, ?, Iterable<EnumerationType.Value>> sampleAnyCombineFn =
        Sample.anyCombineFn(100);
    Field aggField =
        Field.of("sampleList", FieldType.array(FieldType.logicalType(BASIC_ENUM_ENUMERATION)));
    pipeline
        .apply(Create.of(elements))
        .apply(
            Group.<BasicEnum>globally().aggregateField("enumeration", sampleAnyCombineFn, aggField))
        .apply(
            ParDo.of(
                new DoFn<Row, List<Integer>>() {
                  @ProcessElement
                  // TODO: List<enum> doesn't get converted properly by ConvertHelpers, so the
                  // following line does
                  // not work. TO fix this we need to move logical-type conversion out of
                  // RowWithGetters and into
                  // the actual getters.
                  //    public void process(@FieldAccess("sampleList") List<BasicEnum.Test> values)
                  // {
                  public void process(@Element Row value) {
                    assertThat(
                        value.getArray(0),
                        containsInAnyOrder(
                            BASIC_ENUM_ENUMERATION.valueOf(1), BASIC_ENUM_ENUMERATION.valueOf(2)));
                  }
                }));

    pipeline.run();
  }