@SuppressWarnings("unchecked")
  @Udf
  public <T> List<T> union(
      @UdfParameter(description = "First array of values") final List<T> left,
      @UdfParameter(description = "Second array of values") final List<T> right) {
    if (left == null || right == null) {
      return null;
    }
    final Set<T> combined = Sets.newLinkedHashSet(left);
    combined.addAll(right);
    return (List<T>) Arrays.asList(combined.toArray());
  }
@Test
  public void shouldReturnNullForArraysOfOnlyNulls() {
    final List<String> input1 = Arrays.asList(null, null);
    final List<String> input2 = Arrays.asList(null, null, null);
    final List<String> result = udf.union(input1, input2);
    assertThat(result, contains(nullValue()));
  }