@Udf
  public <T> List<T> distinct(
      @UdfParameter(description = "Array of values to distinct") final List<T> input) {
    if (input == null) {
      return null;
    }
    final Set<T> distinctVals = Sets.newLinkedHashSetWithExpectedSize(input.size());
    distinctVals.addAll(input);
    return new ArrayList<>(distinctVals);
  }
@SuppressWarnings("unchecked")
  @Test
  public void shouldDistinctArrayOfMaps() {
    final Map<String, Integer> map1 = ImmutableMap.of("foo", 1, "bar", 2, "baz", 3);
    final Map<String, Integer> map2 = ImmutableMap.of("foo", 10, "baz", 3);
    final Map<String, Integer> map3 = ImmutableMap.of("foo", 1, "bar", 2, "baz", 3);
    final List<Map<String, Integer>> result = udf.distinct(Arrays.asList(map1, map2, map3));
    assertThat(result, contains(map1, map2));
  }